Answered
Adding a function with a specific value
You define f as a function handle. Then you have to call it with an argument also: f = @(x) x^4 - 7 * x^3 + 9 * x^2 + 7 * x - 5...

5 years ago | 0

Answered
Selecting and filtering a range of rows periodically
In your case the data length 7200 is a multiple of 1200 by accident. This can be used: A = rand(819600, 3); n = size(A, 1) / 1...

5 years ago | 1

| accepted

Answered
Create a table inside a structure
Remember that struct('a', {}) creates an empty struct array. Then inserting a table should fail. What is the purpose ofg cell({...

5 years ago | 0

Answered
Calculating weighted mean of large matrix
Loops are very slow in Matlab... ...version 5.3 from 1999. Since Matlab 6 the JIT acceleration improves the speed of loops mass...

5 years ago | 1

| accepted

Answered
How can I print large paragraphs of text?
Do not store large portions of text inside the M-file. Use a text file or a set of text files and import them dynamically. Separ...

5 years ago | 0

| accepted

Answered
Is the C code generated by Matlab Coder Faster than my Matlab Code?
A good question. I do not think, that there is a general answer. It will depened on your code. If e.g. the file transfer is the ...

5 years ago | 0

| accepted

Answered
ODE45 and a variable that assumes multiple values during the timespan
The example code in the documentation of ODE45 uses INTERP1 to calculate a parameter in the function to be calculated. The Dorma...

5 years ago | 1

| accepted

Answered
Why do i recieve this error?
This appears in your code: mse=1/m(sum(w_opt(1)+w_opt(j)*X_train(i,j)-y_train(i))^2); % ^^^^^ This treats m as a variable...

5 years ago | 0

| accepted

Answered
For Loop Indexing of matrices
X = rand(36, 355); w = 25; % Width of the tiles sX = size(X); M = [repmat(w, 1, floor(sX(2) / w)),...

5 years ago | 0

Answered
Saving data from a double for loop
Frame =[1:10]; % No need for the concatenation operator [] here % But "Frame" is overwritten by this at all: for Frame = 1...

5 years ago | 1

Answered
How to scan through a cell array with mixed data types based on a specific index condition and changeable row size?
In the first step I want to extract each row index from the attachment right before the string 'EndCurve' % Assuming that your ...

5 years ago | 1

| accepted

Answered
Find the first and last 1 in each column
first = zeros(1, size(X, 2)); % Pre-allocation last = first; for k = 1:size(X, 2) indexI = find(X(:, k) == 1, 1, 'firs...

5 years ago | 0

Answered
Load from subfolders in directory
Are you working with Windows, Linux or MacOS? What is the path of your Desktop folder? Desktop = fullfile(getenv('USERPROFILE'...

5 years ago | 0

| accepted

Answered
How do I make a lower triangular matrix from a column vector?
Create the symmetric matrix directly: n = 24; Ind = zeros(n, n); Ind((1:n) >= (1:n).') = 1:300; Ind = Ind + Ind.' - diag(d...

5 years ago | 1

| accepted

Answered
How to apply filters for multiple variables?
In the 2nd loop, i is running over the number of elements of rearindex. Comparing it with the excludeidx is not matching anymore...

5 years ago | 0

| accepted

Answered
Remove all number that comes after in cell array
With some bold guessing: A = {[1, 2, 3, 4, 5], [20], [57, 58, 59, 60]}; B = [3, 59]; iB = 1; for iA = 1:numel(A) ...

5 years ago | 0

| accepted

Answered
DIfferential equations and Matlab
"V1" is the first component of V. So write it as V(1). There is no need for elementwise operators here, but they operate on sca...

5 years ago | 1

| accepted

Answered
How to definie FontSize for Ticks on Axes when printing figures to files
Did you try export_fig already?

5 years ago | 0

Answered
Undefined function or variable 'Throughtput_Cell'.
The error message is clear: There is no function in Matlab's path, which is called "Throughput_Cell.m". Do you assume, that the...

5 years ago | 0

Answered
How to sort a table based off of values in one row in MATLAB
sortedTable = sortrows(SmallerTable, {'GroupB'})

5 years ago | 0

Answered
float to binary ?
Are you sure that there is a rounding? Or is it the display in the command window only? A = 0.569546; B = float2bin(A) C = bi...

5 years ago | 0

Answered
Why is unique() giving me the matrix after eliminating the common rows for these two matrices?
If you use a matrix as input to unique, a vector is replied. So if you matrix is not changed, it cannot be an output of unique()...

5 years ago | 0

Answered
Index exceeds the number of array elements (1)
With some guessing: EA is a scalar: EA = 0.0015*200*(10^9); Then you cannot access elements of EA > 1: for k = 1:NE ......

5 years ago | 0

Answered
No iso file in downloaded zip file?
Yes: The downloaded ZIP file contains the contents of the ISO file. There is no reason to include an additional ISO file. Why do...

5 years ago | 0

Answered
How to Find Index of Repeated Elements in a Vector?
x = [7, 22, 16, 20, 22, 3, 6, 22, 5] index = 5; a = x(5) index = find(x == a) % Or: [UniqX, iX, iUniqX] = unique(x)

5 years ago | 1

| accepted

Answered
Sort tables within a cell by size
Try this - I cannot check it, because I do not have your input data: Len = cellfun(@height, C); % [EDITED] @length -> @height...

5 years ago | 0

| accepted

Answered
How to create column vector by the transpose?
The quote ' is not the transpose operator, but the complex transposition. To be exact the tranpose operator is .' including t...

5 years ago | 1

| accepted

Answered
How to bring Data in usable form?
To be able to guess, what "usable" means, we need to know, what do you want to use the data for. Maybe you should convert the ti...

5 years ago | 1

Answered
When using ODE45, can I specify a variable to assume two different values during the timespan?
ODE45 is designe to integrate smooth functions only. To change a parameter you have to integrate in chunks: tSwitch1 = 10.0 tS...

5 years ago | 0

Answered
Loop to iterate ode45 function
figure; axes('NextPlot', 'add'); for e = 0:0.2:1 [t, x] = ode45(@(t, y) F(t, y, e), [0, 20], [0, 1]); plot(t, x(:,1)...

5 years ago | 0

| accepted

Load more