Answered
Error using odearguments (line 113) Inputs must be floats, namely single or double.
What is the purpose of this line: format long,qgin,c_g_in,c,c_l_in,vg,vl,m,ql,v_max,v,xp,yxco,yxh2,mu,kd,c0,c0g,ngout,qgout; I...

5 years ago | 0

Answered
A little question of [] and for loop
By the way, this code is a standard example of a programming style, which wastes ressources. A = []; for i=1:50 A=[A i]; ...

5 years ago | 1

Answered
Run a script in each subfolders and extract results for each subfolders in another folder
FileList = dir(fullfile(Folder, '**', 'file.mat')); for iFile = 1:numel(FileList) SubFolder = FileList(iFile).folder; ...

5 years ago | 1

| accepted

Answered
Index exceeds the number of array elements (101)
Use the debugger to find the not matichiung index. Type this in the command window: dbstop if error and run the code again. Wh...

5 years ago | 0

Answered
How to remove this error? The grid vectors must contain unique points.
The error message tells you, that TWT does not contain unique values. It is impossible to gues, how you want to solve this probl...

5 years ago | 0

Answered
Passing time step from ODE solver (ode23tb) to ODE function
You can use the OutputFcn to store the successful steps in a persitent variable, which can be forwarded to the function to bbe i...

5 years ago | 1

| accepted

Answered
how matlab stores graphics objects?
This shows, that the displayed "Bytes" in the output of whos does not mean the actually used memory. Note that a variable has an...

5 years ago | 0

Answered
Error using plot Vectors must be the same length.
Use the debugger to find the cause of the problem. Type in the command line: dbstop if error Run the code again. If it stops, ...

5 years ago | 0

Answered
ODE 45 Not enough input arguments
We cannot see it, because you have not posted the complete code. But this has been the reason in many other questions in this fo...

5 years ago | 0

Answered
How to delete empty rows in a cell array?
empty = cellfun('isempty', C); C(empty) = [];

5 years ago | 0

| accepted

Answered
Two-body problem program gone wrong
Decrease the tolerance to reduce the truncation errors: opt = odeset('AbsTol', 1e-8, 'RelTol', 1e-8); [t,y]= ode45(odefun,tspa...

5 years ago | 1

| accepted

Answered
memory errors with large amounts of csv files
Extract the wanted value during the reading. There is no need to store the complete tables. grains = zeros(1, num_files); % Pr...

5 years ago | 0

| accepted

Answered
switch case & operators
This is not the purpose of SWITCH/CASE. Please read the documentationm again: doc switch SWITCH evaluates its argument, ibn yo...

5 years ago | 1

Answered
How to add elements to the matrix with a certain pattern?
A = [1 2 3 4; 4 3 2 1; 5 2 3 1]; Ini = [2, 2]; Fin = [3, 4]; SumAllPaths(A, Ini, Fin); function S = SumAllPa...

5 years ago | 0

Answered
Can anyone help me with my code?
ODE45 calls the function to be integrated with 2 inputs: the scalar time t and the vector x. Definming this function with 4 inp...

5 years ago | 0

Answered
How to circ shift rows by different increments
What does "shift" mean? Circular shifting the elements? Adding a value to the contents of the elements? A = rand(100, 100); s ...

5 years ago | 1

Answered
While loop inside another while loop
The code of my other questions spends the most time for updating the figure. Even closing the figure finally takes several secon...

5 years ago | 0

Answered
Determine Type of noise in a signal?
This is not possible, if you only have the given information. The signal could be the sea-level at a specific location. If you ...

5 years ago | 0

| accepted

Answered
Getting Error while starting up the Matlab on windows 10
"Filesystem error" sounds like the file system is damaged. This is not a problem of Matlab. Check the disk by CHKDSK and control...

5 years ago | 0

Answered
Applying multiple constraints for while loop saving final output variables together
Your original code does not run, because the variable "i" is not defined initially. Maybe Matlab uses the default definition of ...

5 years ago | 1

| accepted

Answered
Variable 'ep3' is undefined on some execution paths.
The message "undefined on some execution paths" means, that there is a possible combination of IF-branches, in which the variabl...

5 years ago | 0

| accepted

Answered
I am interested to develop this numerical model, but i don't know how to start it ?
Start with defining your goal. How should the result look like? Is it enough to write some scripts without documentation, which ...

5 years ago | 2

Answered
Best way to reduce to a simple loop?
The first block can be simplified to: i2 = 2; % This is 2 in the first iteration, and 1 afterwards index = NaN; for i1 ...

5 years ago | 0

Answered
While loop inside another while loop
The main problem of your code is, that you increase m in the inner loop, but do not reset it to 1 inside the outer loop. So you ...

5 years ago | 0

Answered
Can I call mex function in other mex functions
The easiest and most efficient solution would be to avoid the overhead of calling a MEX function, but to embed the needed code d...

5 years ago | 0

| accepted

Answered
how to vectorise or speed up the specific code
ar = [0 0 0]; This creates a double array. ar = ar + single(AccelDouble); Here AccelDouble is converted to a single at first,...

5 years ago | 1

Answered
How can i do it fast way ?
3 times faster: Replace index1 = find( (example{i, 1}(:, 2) >= var1 )==1); index2 = find( (example{i, ...

5 years ago | 0

| accepted

Answered
What is the algorithm used by svd function?
In old versions Matlab has used the optimzed version of LAPACK:dgesvd http://www.netlib.org/lapack/explore-html/d1/d7e/group__d...

5 years ago | 0

Answered
Removing the top rows of a csv file
Folder = 'D:\Your\Folder'; FileList = dir(fullfile(Folder, '*.csv')); for iFile = 1:numel(FileList) File = fullfile(Fo...

5 years ago | 0

| accepted

Answered
Load and store several .wav files within multiple subfolders
AudioArray = cell(1, numel(theFiles)); for k = 1 : numel(theFiles) % NUMEL is more direct than LENGTH baseFileName = th...

5 years ago | 0

Load more