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

Plot command inside a loop will not display all data unless drawnow is used

Missing plots can happen, if a timer or GUI callback changes the current figure. Instead of the instabkle method to set the curr...

Plot command inside a loop will not display all data unless drawnow is used

Missing plots can happen, if a timer or GUI callback changes the current figure. Instead of the instabkle method to set the curr...

4 jours ago | 0

| accepted

Answered

How do I convert a 3d cell array of different size to matrix?

M = cat(3, ETT{:}); No, this cannot create a 1x10 matrix.

How do I convert a 3d cell array of different size to matrix?

M = cat(3, ETT{:}); No, this cannot create a 1x10 matrix.

4 jours ago | 0

| accepted

Answered

how can I appropriately get a for loop to extract wav files to sub folders(directories)??

List = dir('\\users\audio_stems\*.wav'); %folders for seperate instruments mkdir Basson mkdir Saxphone mkdir Clarinet mkdir...

how can I appropriately get a for loop to extract wav files to sub folders(directories)??

List = dir('\\users\audio_stems\*.wav'); %folders for seperate instruments mkdir Basson mkdir Saxphone mkdir Clarinet mkdir...

4 jours ago | 0

| accepted

Answered

Is it possible to vectorize this loop?

A = rand(1, 1000); B = rand(1, 1000); tic for k = 1:1000 w = 0; for i = 1:length(A) w = w + A(i).*B; end end...

Is it possible to vectorize this loop?

A = rand(1, 1000); B = rand(1, 1000); tic for k = 1:1000 w = 0; for i = 1:length(A) w = w + A(i).*B; end end...

4 jours ago | 1

Answered

Using fprintf to repeat the statement multiple times

Almost working. n = input('Enter a integer: '); for k = 1:n fprintf('I love this stuff\n') end Ask for n before the loo...

Using fprintf to repeat the statement multiple times

Almost working. n = input('Enter a integer: '); for k = 1:n fprintf('I love this stuff\n') end Ask for n before the loo...

5 jours ago | 0

| accepted

Answered

I have two 3d points, A(1,0,0) and B(0,1,0). And I connect these two points as a line AB. How to divide this line into 10 equally segments and get their coordinates?

A = [1, 0, 0]; B = [0, 1, 0]; ab = B - A; v = linspace(0, 1, 10).'; C = A + v .* ab % >= R2016b, auto-expanding % ...

I have two 3d points, A(1,0,0) and B(0,1,0). And I connect these two points as a line AB. How to divide this line into 10 equally segments and get their coordinates?

A = [1, 0, 0]; B = [0, 1, 0]; ab = B - A; v = linspace(0, 1, 10).'; C = A + v .* ab % >= R2016b, auto-expanding % ...

6 jours ago | 0

Answered

how do i substract the first value from the last one on an array taking out zero values?

Get the corresponding indices: first = find(X, 1, 'first'); last = find(X, 1, 'last'); Result = X(last) - X(first)

how do i substract the first value from the last one on an array taking out zero values?

Get the corresponding indices: first = find(X, 1, 'first'); last = find(X, 1, 'last'); Result = X(last) - X(first)

8 jours ago | 0

| accepted

Answered

how to solve this error: Error using ' TRANSPOSE does not support N-D arrays. Use PAGETRANSPOSE/PAGECTRANSPOSE to transpose pages or PERMUTE to reorder dimensions of N-D arrays

What is the size of u10 ? u10 = double(ncread(nc_windfile, 'u10')) ; size(u10) If it has more than 2 dimensions, u10' is not ...

how to solve this error: Error using ' TRANSPOSE does not support N-D arrays. Use PAGETRANSPOSE/PAGECTRANSPOSE to transpose pages or PERMUTE to reorder dimensions of N-D arrays

What is the size of u10 ? u10 = double(ncread(nc_windfile, 'u10')) ; size(u10) If it has more than 2 dimensions, u10' is not ...

8 jours ago | 0

| accepted

Answered

How to calculate each result of f(x) in the nested for loop?

This is correct, but not useful: j = sqrt(-1); i and j are defined as imaginary units as default already. But you see the ambi...

How to calculate each result of f(x) in the nested for loop?

This is correct, but not useful: j = sqrt(-1); i and j are defined as imaginary units as default already. But you see the ambi...

9 jours ago | 0

Answered

input and output functions

Name your function fibseq. So call it fibseq.m, not "Fibseq.m". The case matters in Matlab. It will have one input n and one ou...

input and output functions

Name your function fibseq. So call it fibseq.m, not "Fibseq.m". The case matters in Matlab. It will have one input n and one ou...

10 jours ago | 1

| accepted

Answered

How to get a function from user without knowing its symbols

See how e.g. fzero and ode45 solves this problem. Here the function has 1 oder 2 variables which must be provided in a specific ...

How to get a function from user without knowing its symbols

See how e.g. fzero and ode45 solves this problem. Here the function has 1 oder 2 variables which must be provided in a specific ...

10 jours ago | 0

Answered

hObject is not created when running GUIDE *.m file - what can be done?

The m-files created by GUIDE are not compatible with other Matlab versions You can expect such troubles.

hObject is not created when running GUIDE *.m file - what can be done?

The m-files created by GUIDE are not compatible with other Matlab versions You can expect such troubles.

11 jours ago | 0

| accepted

Answered

Break loop with button click Appdesigner GUI [Both plot and button are in different callback functions]

function main FigH = figure; ButtonH = uicontrol(FigH, 'Style', 'PushButton', 'String', 'Stop', 'Call...

Break loop with button click Appdesigner GUI [Both plot and button are in different callback functions]

function main FigH = figure; ButtonH = uicontrol(FigH, 'Style', 'PushButton', 'String', 'Stop', 'Call...

11 jours ago | 1

| accepted

Answered

Why Index exceeds the number of array elements (1) if I change the input order in the anonymous function?

ode45 calls the function to be integrated as f(t, Y) . So the time must be the first input.

Why Index exceeds the number of array elements (1) if I change the input order in the anonymous function?

ode45 calls the function to be integrated as f(t, Y) . So the time must be the first input.

11 jours ago | 1

| accepted

Answered

Extract rows from 2 different matrices with different dimensions using If statement

if AR(:,5)==n; This is a vector in the condition. Therefore Matlab inserts an all() implicitly, because conditions of if statem...

Extract rows from 2 different matrices with different dimensions using If statement

if AR(:,5)==n; This is a vector in the condition. Therefore Matlab inserts an all() implicitly, because conditions of if statem...

11 jours ago | 1

| accepted

Answered

inputdlg does not work Matlab 2020a

User the debugger to find out more details. Type in in the command window: dbstop if caught error Now run the code again and c...

inputdlg does not work Matlab 2020a

User the debugger to find out more details. Type in in the command window: dbstop if caught error Now run the code again and c...

11 jours ago | 1

Answered

if statement/numel (A)

These condition does not do, what you expect: 1<=(i + a)<=numel(A) 1<=(i - a)<=numel(A) They are evaluated from left to right...

if statement/numel (A)

These condition does not do, what you expect: 1<=(i + a)<=numel(A) 1<=(i - a)<=numel(A) They are evaluated from left to right...

11 jours ago | 0

Answered

How to find euclidean distances between cell entries of two RGB matrices?

A = rand(47, 47, 3); B = rand(1, 456 3); AB = reshape(A, 47*47, 1, 3) - B; Dist = vecnom(AB, 2, 3); And now you want to fi...

How to find euclidean distances between cell entries of two RGB matrices?

A = rand(47, 47, 3); B = rand(1, 456 3); AB = reshape(A, 47*47, 1, 3) - B; Dist = vecnom(AB, 2, 3); And now you want to fi...

18 jours ago | 0

Answered

How do I use characters with an if statement?

Prompt = 'Please press any key to roll the dice, press Q or q to quit program: '; str = input(Prompt, 's'); if strncmpi(str...

How do I use characters with an if statement?

Prompt = 'Please press any key to roll the dice, press Q or q to quit program: '; str = input(Prompt, 's'); if strncmpi(str...

environ un mois ago | 0

Answered

Random draw without re-delivery in a loop

What are your input data? A list of files stored in a folder? (As usual: please explain this instead of letting the readers gues...

Random draw without re-delivery in a loop

What are your input data? A list of files stored in a folder? (As usual: please explain this instead of letting the readers gues...

environ un mois ago | 0

| accepted

Answered

search in large cell file

In the loop all lines are stored in the cell an the loops stops, if the last one was not a CHAR. This means, that the last eleme...

search in large cell file

In the loop all lines are stored in the cell an the loops stops, if the last one was not a CHAR. This means, that the last eleme...

environ un mois ago | 1

| accepted

Question

MEX api and interleaved complex arrays

Does MATLAB store complex data in interleaved format since R2018a? If you compile a MEX function with the -R2018a flag, you can...

environ un mois ago | 1 answer | 0

Answered

Reversible matrix in matlab

You want to identify a "regular matrix and non-singular matrix". Then testing only, if it is square and not a zero matrix ist no...

Reversible matrix in matlab

You want to identify a "regular matrix and non-singular matrix". Then testing only, if it is square and not a zero matrix ist no...

environ 2 mois ago | 0

Answered

Calculation precision changed in 2020b?

The ACOS function is numerically instable at 0 and pi. SUM is instable at all. A trivial example: sum([1, 1e17, -1]) .There are...

Calculation precision changed in 2020b?

The ACOS function is numerically instable at 0 and pi. SUM is instable at all. A trivial example: sum([1, 1e17, -1]) .There are...

environ 2 mois ago | 1

Answered

Why stock DOT function is suboptimally implemented

Just a comment: Under Matlab 2018b, Core i5-3320M CPU @ 2.60GHz: Elapsed time is 0.249669 seconds. dot(z,z) Elapsed time is ...

Why stock DOT function is suboptimally implemented

Just a comment: Under Matlab 2018b, Core i5-3320M CPU @ 2.60GHz: Elapsed time is 0.249669 seconds. dot(z,z) Elapsed time is ...

environ 2 mois ago | 0

Answered

How to concatenate matrices to calculate mean

As Steven has mentioned already, this is the main problem: "I have 40 matrices DJF1979_1980_125 to DJF2019_2020_125" Do not us...

How to concatenate matrices to calculate mean

As Steven has mentioned already, this is the main problem: "I have 40 matrices DJF1979_1980_125 to DJF2019_2020_125" Do not us...

environ 2 mois ago | 0

Submitted

ScaleTime

Fast linear interpolation of equally spaced data (C-MEX and M)

environ 2 mois ago | 12 downloads |

Answered

How to read data from a file into cell array keeping indents undisturbed

% Import file: Str = fileread('file.ext'); % Remove trailing line break to avoid appending an additional empty line: if ~is...

How to read data from a file into cell array keeping indents undisturbed

% Import file: Str = fileread('file.ext'); % Remove trailing line break to avoid appending an additional empty line: if ~is...

2 mois ago | 0

| accepted

Answered

Not enough input arguments error

What about replacing: for j= 1:N if x(j)<beta1 & x(j)>beta2 f(1,j)=f02(x(j)); end if x(j)>beta1 & x(j)<...

Not enough input arguments error

What about replacing: for j= 1:N if x(j)<beta1 & x(j)>beta2 f(1,j)=f02(x(j)); end if x(j)>beta1 & x(j)<...

2 mois ago | 0

Answered

command window no output

Check if you have shadowed the display function: w = cellstring(which('display', '-all')); fprintf('%s\n', w{:}) What do you ...

command window no output

Check if you have shadowed the display function: w = cellstring(which('display', '-all')); fprintf('%s\n', w{:}) What do you ...

2 mois ago | 0