Suspensa Vix Via Fit

Answered

Why Nested For Loop Is not showing me the index values from 1 to N interval ?

MATLAB does not display infinite lines in the command window scroll buffer. By default it displays the last 5000 lines, as expla...

Why Nested For Loop Is not showing me the index values from 1 to N interval ?

MATLAB does not display infinite lines in the command window scroll buffer. By default it displays the last 5000 lines, as expla...

3 hours ago | 0

| accepted

Answered

How to read .txt file which have complex numbers and how to separate real and imaginary parts of the complex numbers?

1. Remove the space characters embedded in the complex numbers: opt = {'MultipleDelimsAsOne',true,'HeaderLines',1}; str = fil...

How to read .txt file which have complex numbers and how to separate real and imaginary parts of the complex numbers?

1. Remove the space characters embedded in the complex numbers: opt = {'MultipleDelimsAsOne',true,'HeaderLines',1}; str = fil...

4 hours ago | 1

Answered

How to print out 2 variables using disp() function

Use concatentation to join the character vectors together into one longer character vector: disp([txt,num2str(area)]) "...the ...

How to print out 2 variables using disp() function

Use concatentation to join the character vectors together into one longer character vector: disp([txt,num2str(area)]) "...the ...

21 hours ago | 0

| accepted

Answered

Compare data sets of different length and make them equal

>> Data_1 = [1, 8 , 10, 11, 24, 30]; >> Data_2 = [2, 4, 5, 21, 9, 7, 1, 3]; >> Data_2(1+numel(Data_1):end) = [] Data_2 = ...

Compare data sets of different length and make them equal

>> Data_1 = [1, 8 , 10, 11, 24, 30]; >> Data_2 = [2, 4, 5, 21, 9, 7, 1, 3]; >> Data_2(1+numel(Data_1):end) = [] Data_2 = ...

23 hours ago | 0

| accepted

Answered

How to add two 3-D matrices?

out = cat(3,Matrix1,Matrix2) This is called concatenation: https://www.mathworks.com/help/matlab/math/creating-and-concatenati...

How to add two 3-D matrices?

out = cat(3,Matrix1,Matrix2) This is called concatenation: https://www.mathworks.com/help/matlab/math/creating-and-concatenati...

1 day ago | 0

| accepted

Answered

Finding min values of third column for rows with similar values

>> M = [2.0000,0,3.1971;1.0000,0,3.1971;3.0000,0,6.4662;1.0000,0,6.4662;3.0000,0,9.6356;2.0000,0,9.6356;2.0000,1,7;1.0000,1,5;3....

Finding min values of third column for rows with similar values

>> M = [2.0000,0,3.1971;1.0000,0,3.1971;3.0000,0,6.4662;1.0000,0,6.4662;3.0000,0,9.6356;2.0000,0,9.6356;2.0000,1,7;1.0000,1,5;3....

2 days ago | 1

| accepted

Answered

How to save a .wav file into different path after processed?

https://www.mathworks.com/help/matlab/matlab_env/specify-file-names.html D = 'absolute or relative path to the folder where you...

How to save a .wav file into different path after processed?

https://www.mathworks.com/help/matlab/matlab_env/specify-file-names.html D = 'absolute or relative path to the folder where you...

2 days ago | 0

| accepted

Answered

How to concatenate cells in mat file under each other?

Your question is unclear: does the mat file contain one cell array of 255 elements, or 255 separate scalar cell arrays? If ther...

How to concatenate cells in mat file under each other?

Your question is unclear: does the mat file contain one cell array of 255 elements, or 255 separate scalar cell arrays? If ther...

2 days ago | 0

Answered

Error Message: Output argument "I" (and maybe others) not assigned during call to "simpsons".

Although you specified one output argument I:, nowhere in the code did you define I: function I = simpsons(f,M,a,b) ... I = ?...

Error Message: Output argument "I" (and maybe others) not assigned during call to "simpsons".

Although you specified one output argument I:, nowhere in the code did you define I: function I = simpsons(f,M,a,b) ... I = ?...

2 days ago | 0

Answered

Comapring Values in one Matrix to another

The simple MATLAB way: >> A = [373,383,393,403,413,420,451,485,499]; >> B = [373,453,457,461,464]; >> C = A(A>min(B)) C = ...

Comapring Values in one Matrix to another

The simple MATLAB way: >> A = [373,383,393,403,413,420,451,485,499]; >> B = [373,453,457,461,464]; >> C = A(A>min(B)) C = ...

5 days ago | 1

Answered

save in a new file using 'save' command

If your function is called in a loop then follow the examples here: https://www.mathworks.com/help/matlab/import_export/process...

save in a new file using 'save' command

If your function is called in a loop then follow the examples here: https://www.mathworks.com/help/matlab/import_export/process...

5 days ago | 0

| accepted

Answered

unique across multiple cells or arrays

>> a = {[1,2,2],[2,3,6,3],[4,3,5,6,7]}; >> [u,x] = unique([a{:}],'first'); % or 'last' to allocate to the last cell where value...

unique across multiple cells or arrays

>> a = {[1,2,2],[2,3,6,3],[4,3,5,6,7]}; >> [u,x] = unique([a{:}],'first'); % or 'last' to allocate to the last cell where value...

5 days ago | 1

| accepted

Answered

Command to exit to the base workspace?

error() As Bruno Luong pointed out, this does not work inside try-catch and also prints text to the command window.

Command to exit to the base workspace?

error() As Bruno Luong pointed out, this does not work inside try-catch and also prints text to the command window.

6 days ago | 1

| accepted

Answered

Location of the "end" statement of the main function in a m. file?

"before first local function" any functions defined after the main function are local functions: https://www.mathworks.com/hel...

Location of the "end" statement of the main function in a m. file?

"before first local function" any functions defined after the main function are local functions: https://www.mathworks.com/hel...

6 days ago | 1

| accepted

Answered

How to convert a char into double?

Note that there are not only numbers in that string, it also contains 'S' characters apparently at random, e,g.: >> f(8480:8500...

How to convert a char into double?

Note that there are not only numbers in that string, it also contains 'S' characters apparently at random, e,g.: >> f(8480:8500...

6 days ago | 1

| accepted

Answered

Variables under the same name in different .mat files

Rather than loading into separate structures and creating numbered variables (which is a bad way to write code), you should simp...

Variables under the same name in different .mat files

Rather than loading into separate structures and creating numbered variables (which is a bad way to write code), you should simp...

6 days ago | 0

Answered

Identify first and last indicies of numbers in an array containing NaN's

Your original idea of using diff is exactly the simple and efficient solution that experienced MATLAB users would use: >> M = [...

Identify first and last indicies of numbers in an array containing NaN's

Your original idea of using diff is exactly the simple and efficient solution that experienced MATLAB users would use: >> M = [...

7 days ago | 0

| accepted

Answered

How to parse text to numbers?

>> ttxt = {'No info';'1-50.00000';'3-100.000';'2-2.0000';'Free & Unlimited';'1-100.0000;1-0.0000';'1-25.000;1-50.000'} ttxt = ...

How to parse text to numbers?

>> ttxt = {'No info';'1-50.00000';'3-100.000';'2-2.0000';'Free & Unlimited';'1-100.0000;1-0.0000';'1-25.000;1-50.000'} ttxt = ...

8 days ago | 1

| accepted

Answered

Separate string with tag_string

This should get you started. Adjust as required. str = 'tag_A(this is tag A, it contains tag_B(this is tag_B, it contains tag_C...

Separate string with tag_string

This should get you started. Adjust as required. str = 'tag_A(this is tag A, it contains tag_B(this is tag_B, it contains tag_C...

8 days ago | 0

| accepted

Answered

Hi, this function is to return the maximum value of 'n' consecutive elements but error index exceeds the number of array elements appears for a random applied vector

The main bug is that you are iterating over data values and not indices as your code requires. On this line you define the loop ...

Hi, this function is to return the maximum value of 'n' consecutive elements but error index exceeds the number of array elements appears for a random applied vector

The main bug is that you are iterating over data values and not indices as your code requires. On this line you define the loop ...

8 days ago | 0

| accepted

Answered

Count number of indexes for each consecutive values in column of array

>> V = [0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0]; >> D = diff([0;V(:);0]); >> find(D<0)-find(D>0) ans = 3 9

Count number of indexes for each consecutive values in column of array

>> V = [0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0]; >> D = diff([0;V(:);0]); >> find(D<0)-find(D>0) ans = 3 9

10 days ago | 0

| accepted

Answered

What should I do to display midnight in datetime?

>> dt = datetime(2019,9,8,0,0,0,'Format','yyyy-MM-dd HH:mm:ss') dt = 2019-09-08 00:00:00

What should I do to display midnight in datetime?

>> dt = datetime(2019,9,8,0,0,0,'Format','yyyy-MM-dd HH:mm:ss') dt = 2019-09-08 00:00:00

10 days ago | 0

Answered

How can I writetable to cell array

Where C is your cell array: for k = 1:numel(C) F = sprintf('file_%d.CSV',k); writetable(C{k},F) end This just follo...

How can I writetable to cell array

Where C is your cell array: for k = 1:numel(C) F = sprintf('file_%d.CSV',k); writetable(C{k},F) end This just follo...

13 days ago | 0

| accepted

Answered

Dynamic vectors into cell

It is very easy to get what you want, you just need to avoid concatenating all of the numeric/logical data together, e.g.: >> D...

Dynamic vectors into cell

It is very easy to get what you want, you just need to avoid concatenating all of the numeric/logical data together, e.g.: >> D...

13 days ago | 0

| accepted

Answered

Using cellfun and regexp question

The simple and efficient solution is to use the 'once' option: sampleRates = regexp(storedSamplerates,'\d+','match','once'); %...

Using cellfun and regexp question

The simple and efficient solution is to use the 'once' option: sampleRates = regexp(storedSamplerates,'\d+','match','once'); %...

13 days ago | 1

Answered

How to remove array items that include a certain substring?

>> C = {'a1','a2','b1','b2','c1','c2'}; >> X = strncmpi(C,'c',1); >> D = C(X) D = 'c1' 'c2'

How to remove array items that include a certain substring?

>> C = {'a1','a2','b1','b2','c1','c2'}; >> X = strncmpi(C,'c',1); >> D = C(X) D = 'c1' 'c2'

14 days ago | 0

Answered

what is the best possible way to find the missing values using interpolation

>> a60 = [1,5,9,13,17,21]; >> t60 = 60*(0:numel(a60)-1); >> t15 = t60(1):15:t60(end); >> a15 = interp1(t60,a60,t15) a15 = ...

what is the best possible way to find the missing values using interpolation

>> a60 = [1,5,9,13,17,21]; >> t60 = 60*(0:numel(a60)-1); >> t15 = t60(1):15:t60(end); >> a15 = interp1(t60,a60,t15) a15 = ...

14 days ago | 0

Answered

convert period (.) to colon (:) for reading time

I don't see why you need to convert any characters, MATLAB imports that format without error: >> str = '2020-07-29 14.42.32'; ...

convert period (.) to colon (:) for reading time

I don't see why you need to convert any characters, MATLAB imports that format without error: >> str = '2020-07-29 14.42.32'; ...

15 days ago | 1

Answered

how to remove rows and columns in cell array ?

Where C is your cell array: C(25419:29317,:) = []; You could also detect those rows automatically: X = all(cellfun(@isempty,C...

how to remove rows and columns in cell array ?

Where C is your cell array: C(25419:29317,:) = []; You could also detect those rows automatically: X = all(cellfun(@isempty,C...

15 days ago | 1

| accepted

Answered

Passing variable from anonymous objective function to main workspace

You can do this easily with nargin: function val = objfun(x,v1,v2) persistent data if ~nargin val = data; return e...

Passing variable from anonymous objective function to main workspace

You can do this easily with nargin: function val = objfun(x,v1,v2) persistent data if ~nargin val = data; return e...

15 days ago | 0