It is easier to solve a problem than to guess, what the problem is.

Questions about FileExchange submissions are welcome - get my address from the code. I do not answer mails concerning questions in the forum.

Answered

Save multiple image automatically

Your code must fail with an error message in this line: outfile = fullfile(outfolder, sprintf(['%s-coba-%03d.%s',basename,'.jpg...

Save multiple image automatically

Your code must fail with an error message in this line: outfile = fullfile(outfolder, sprintf(['%s-coba-%03d.%s',basename,'.jpg...

6 hours ago | 0

Answered

How to make a +5 (or any +number) jump in array values inside a for loop?

You can use FEX: RunLength , or this part taken from it: function n = RunLength_count(x) d = [true, diff(x(:).') ~= 0, true]; ...

How to make a +5 (or any +number) jump in array values inside a for loop?

You can use FEX: RunLength , or this part taken from it: function n = RunLength_count(x) d = [true, diff(x(:).') ~= 0, true]; ...

6 hours ago | 0

Answered

Can't start Matlab

I guess, that the preferences folder is damaged. Try to recreate it by renaming 'C:\Users\<youraccount>\AppData\Roaming\MathWork...

Can't start Matlab

I guess, that the preferences folder is damaged. Try to recreate it by renaming 'C:\Users\<youraccount>\AppData\Roaming\MathWork...

7 hours ago | 0

Answered

Reading a text file containing strings and numeric data

fid = fopen(File, 'r'); if fid < 0, error('Cannot open file'); end TimeLen = 1e6; TimeIndex = 0; Time = zeros(1, Ti...

Reading a text file containing strings and numeric data

fid = fopen(File, 'r'); if fid < 0, error('Cannot open file'); end TimeLen = 1e6; TimeIndex = 0; Time = zeros(1, Ti...

7 hours ago | 0

| accepted

Answered

ode45, Please tell me how to fix this?

Did you save one of your functions as "ode45.m" file? Check this in the command window: which ode45 -all If you find a user-de...

ode45, Please tell me how to fix this?

Did you save one of your functions as "ode45.m" file? Check this in the command window: which ode45 -all If you find a user-de...

8 hours ago | 0

Answered

How do I compute the mean value of odd rows of a random matrix (mxm)? (using if and rem)

I do not have any idea, how "if" can be used to produce a random matrix. But using REM() to get the odd indices is easy: for ...

How do I compute the mean value of odd rows of a random matrix (mxm)? (using if and rem)

I do not have any idea, how "if" can be used to produce a random matrix. But using REM() to get the odd indices is easy: for ...

8 hours ago | 0

Answered

How to extract specific row from a large csv file and reshape it

Data = csvread(FileName); Row = [1, 100, 200, 300]; figure; for iRow = 1:numel(Row) Block = reshape(Data(iRow, :), 8, 8...

How to extract specific row from a large csv file and reshape it

Data = csvread(FileName); Row = [1, 100, 200, 300]; figure; for iRow = 1:numel(Row) Block = reshape(Data(iRow, :), 8, 8...

8 hours ago | 0

Answered

How to append values from different files to an array?

Do not use "mean" as name of a variable, because then you cannot use the function mean() anymore. Folder = 'C:\Your\Folder'; ...

How to append values from different files to an array?

Do not use "mean" as name of a variable, because then you cannot use the function mean() anymore. Folder = 'C:\Your\Folder'; ...

8 hours ago | 0

Answered

Prime number sum from cell array

The variable myArr is a double array. Then isstrprop(myArr, 'digit') is FALSE for all elements, because onbly CHARs can be digit...

Prime number sum from cell array

The variable myArr is a double array. Then isstrprop(myArr, 'digit') is FALSE for all elements, because onbly CHARs can be digit...

8 hours ago | 0

Answered

Completing elements of a matrix

a = [2; 3]; b = [1.5; 2]; c = kron(a, [ones(size(a,1), 1), b])

Completing elements of a matrix

a = [2; 3]; b = [1.5; 2]; c = kron(a, [ones(size(a,1), 1), b])

8 hours ago | 0

Answered

How to compare two strings with different sizes?

A bold guess: a = 'AAGCTACGC' b = 'ACGCAA' Nmin = min(numel(a), numel(b)); Nmax = max(numel(a), numel(b)); match = fals...

How to compare two strings with different sizes?

A bold guess: a = 'AAGCTACGC' b = 'ACGCAA' Nmin = min(numel(a), numel(b)); Nmax = max(numel(a), numel(b)); match = fals...

8 hours ago | 0

Answered

matrix product different sizes

The multiplication of a 36-by-36 and a 36-by-10 matrix is mathematically defined and creates a 36-by-10 matrix. But you cannot m...

matrix product different sizes

The multiplication of a 36-by-36 and a 36-by-10 matrix is mathematically defined and creates a 36-by-10 matrix. But you cannot m...

9 hours ago | 0

| accepted

Answered

using a function with matrices

"function [rating] = rating(x,y)" does not match the information, that the function has 3 inputs. "gives the error message that...

using a function with matrices

"function [rating] = rating(x,y)" does not match the information, that the function has 3 inputs. "gives the error message that...

18 hours ago | 0

Answered

Does Matlab consultant Adam Danz or Matlab undelete my Matlab questions, which where deleted for reasons I cannot follow?

I do understand, that you want to clarify why your questions have been considered as spam. As far as I can see, your questions d...

Does Matlab consultant Adam Danz or Matlab undelete my Matlab questions, which where deleted for reasons I cannot follow?

I do understand, that you want to clarify why your questions have been considered as spam. As far as I can see, your questions d...

19 hours ago | 0

Answered

Figure not showing up when attempting to plot array

It takes only a second on my system (Win10 Matlab 2018b). So either there is an open but hidden window or another problem. Chec...

Figure not showing up when attempting to plot array

It takes only a second on my system (Win10 Matlab 2018b). So either there is an open but hidden window or another problem. Chec...

1 day ago | 0

Answered

Matlab does not plot data which are mirrored data

If the 2nd half of the data equals the 1st half in different order, you do plot all data, but the line overlap. See: r = [1 0...

Matlab does not plot data which are mirrored data

If the 2nd half of the data equals the 1st half in different order, you do plot all data, but the line overlap. See: r = [1 0...

2 days ago | 1

Answered

Is there a way to get an 8 x 1 matrix instead of 8 x 3 using dec2bin or any other?

If you want 000 as output, remember, that this is not a valid decimal value. If you need the zeros for any reason, you have to s...

Is there a way to get an 8 x 1 matrix instead of 8 x 3 using dec2bin or any other?

If you want 000 as output, remember, that this is not a valid decimal value. If you need the zeros for any reason, you have to s...

2 days ago | 1

Answered

How can I set the default text size on figures in matlab 2018?

The default of an axes works exactly as you have defined it: figure; axes; set(gca, 'DefaultTextFontSize', 35) text(0.5, 0.5,...

How can I set the default text size on figures in matlab 2018?

The default of an axes works exactly as you have defined it: figure; axes; set(gca, 'DefaultTextFontSize', 35) text(0.5, 0.5,...

2 days ago | 0

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...

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...

2 days 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]; ...

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]; ...

2 days 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; ...

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; ...

2 days 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...

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...

2 days 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...

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...

2 days 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...

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...

2 days 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...

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...

2 days 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, ...

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, ...

4 days 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...

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...

4 days ago | 0

Answered

How to delete empty rows in a cell array?

empty = cellfun('isempty', C); C(empty) = [];

How to delete empty rows in a cell array?

empty = cellfun('isempty', C); C(empty) = [];

4 days 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...

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 days 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...

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 days ago | 0

| accepted