Suspensa Vix Via Fit

Answered

While loop not starting

Lets have a look at the first y value: >> f = @(x) 4*x^2 - 3; >> x(1) = 0.5; >> y(1) = f(x(1)) y = -2 And now look at your ...

While loop not starting

Lets have a look at the first y value: >> f = @(x) 4*x^2 - 3; >> x(1) = 0.5; >> y(1) = f(x(1)) y = -2 And now look at your ...

alrededor de 17 horas ago | 0

| accepted

Answered

FSOLVE requires all values returned by functions to be of data type double

The function handle definition is incorrect: @(B)@ourfun What you defined is an anonymous function which when called accepts o...

FSOLVE requires all values returned by functions to be of data type double

The function handle definition is incorrect: @(B)@ourfun What you defined is an anonymous function which when called accepts o...

alrededor de 23 horas ago | 1

| accepted

Answered

Indexing with two matrices

>> [C,~] = find(bsxfun(@eq,permute(A,[1,3,2]),permute(B,[3,1,2]))); >> C = reshape(C,size(B)) C = 2 1 2 4 3 4

Indexing with two matrices

>> [C,~] = find(bsxfun(@eq,permute(A,[1,3,2]),permute(B,[3,1,2]))); >> C = reshape(C,size(B)) C = 2 1 2 4 3 4

1 día ago | 0

Answered

How to search through entirety of one field of a structure

The general solution is to use comma-separated lists: https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.h...

How to search through entirety of one field of a structure

The general solution is to use comma-separated lists: https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.h...

2 días ago | 0

Answered

Importing data with unequal number of column

This is very simple and efficient using fscanf: [fid,msg] = fopen('Data.txt','rt'); assert(fid>=3,msg) mat = fscanf(fid,'%f',...

Importing data with unequal number of column

This is very simple and efficient using fscanf: [fid,msg] = fopen('Data.txt','rt'); assert(fid>=3,msg) mat = fscanf(fid,'%f',...

3 días ago | 1

| accepted

Answered

Extracting second number after comma within parenthesis

Simply match all text from the comma to the whitespace: >> str = 'Toc(Clock Data Ref Time) : 0x91E6 (37350,5.976000e+005 s...

Extracting second number after comma within parenthesis

Simply match all text from the comma to the whitespace: >> str = 'Toc(Clock Data Ref Time) : 0x91E6 (37350,5.976000e+005 s...

3 días ago | 0

Answered

Using strcmp with multiple inputs

You could use strfind or a regular expression to help you, e.g.: >> ixc = cellfun(@ischar,rw(:,3)); >> ixc(ixc) = ~cellfun('is...

Using strcmp with multiple inputs

You could use strfind or a regular expression to help you, e.g.: >> ixc = cellfun(@ischar,rw(:,3)); >> ixc(ixc) = ~cellfun('is...

3 días ago | 0

| accepted

Answered

declaring a new table

For historic and compatibility reasons if the variable does not exist before the dot-indexing allocates to it, then MATLAB will ...

declaring a new table

For historic and compatibility reasons if the variable does not exist before the dot-indexing allocates to it, then MATLAB will ...

3 días ago | 0

Answered

How to convert these char values to datetime format?

The error is caused by the milliseconds in start string: either you need to remove them from the input string, or specify them i...

How to convert these char values to datetime format?

The error is caused by the milliseconds in start string: either you need to remove them from the input string, or specify them i...

4 días ago | 1

| accepted

Answered

Trying to modify a vector by removing alternate elements

There is no point in defining n when it always has exactly the same value as the loop iteration variable i. Get rid of one of th...

Trying to modify a vector by removing alternate elements

There is no point in defining n when it always has exactly the same value as the loop iteration variable i. Get rid of one of th...

4 días ago | 1

| accepted

Answered

How to solve pre-allocating array?

Using numbered variables is a sign that you are doing something wrong. Accessing numbered variables is one way that beginners f...

How to solve pre-allocating array?

Using numbered variables is a sign that you are doing something wrong. Accessing numbered variables is one way that beginners f...

5 días ago | 1

| accepted

Answered

How to pass a matrix (m, 1) to (m / 2.2)

>> reshape(V,2,[]).' ans = 1 2 3 4 5 6

How to pass a matrix (m, 1) to (m / 2.2)

>> reshape(V,2,[]).' ans = 1 2 3 4 5 6

7 días ago | 1

| accepted

Answered

How to generate 1 cross zero structure in Matlab??

B = reshape(A,1,0)

How to generate 1 cross zero structure in Matlab??

B = reshape(A,1,0)

7 días ago | 1

| accepted

Answered

How to call a created function in a different function

Download my FEX submission num2ordinal and use it together with func2str: function out = myNewFunc(fun) val = str2double(regex...

How to call a created function in a different function

Download my FEX submission num2ordinal and use it together with func2str: function out = myNewFunc(fun) val = str2double(regex...

9 días ago | 0

| accepted

Answered

flip an array with the use of vectors

"Any suggestions?" Use indexing (which in MATLAB starts from 1): >> a = [1,7,5,9,3,2,4,1] a = 1 7 5 9 3 2 4 ...

flip an array with the use of vectors

"Any suggestions?" Use indexing (which in MATLAB starts from 1): >> a = [1,7,5,9,3,2,4,1] a = 1 7 5 9 3 2 4 ...

11 días ago | 0

| accepted

Answered

Using Read Table with a predefined Table size

Accessing files via the OS is slow, note that creating an intermediate file requires accessing a file minimum three times. A sim...

Using Read Table with a predefined Table size

Accessing files via the OS is slow, note that creating an intermediate file requires accessing a file minimum three times. A sim...

11 días ago | 1

Answered

How can I dynamically index into a nested struct that contains cell arrays

Essentially you are attempting to write a MATLAB parser using MATLAB. Such a task is not trivial, but for a very limited subset ...

How can I dynamically index into a nested struct that contains cell arrays

Essentially you are attempting to write a MATLAB parser using MATLAB. Such a task is not trivial, but for a very limited subset ...

11 días ago | 0

| accepted

Answered

How can I delete two or more elements in a vector?

>> A = [1,1,2,3,10,7,10,1,5,3]; >> U = unique(A); >> Z = U(histc(A,U)==1) Z = 2 5 7

How can I delete two or more elements in a vector?

>> A = [1,1,2,3,10,7,10,1,5,3]; >> U = unique(A); >> Z = U(histc(A,U)==1) Z = 2 5 7

12 días ago | 1

| accepted

Answered

inputs of multi-variable functions?

"Is there a right order for input variables in a function?" Yes: MATLAB function inputs are positional: The 1st input provided...

inputs of multi-variable functions?

"Is there a right order for input variables in a function?" Yes: MATLAB function inputs are positional: The 1st input provided...

12 días ago | 0

| accepted

Answered

how to rearrange cell array with the grouped sequence

>> C = {21,3,'1';31,2,'1 1';25,1,'2 2 1 1'} C = [21] [3] '1' [31] [2] '1 1' [25] [1] ...

how to rearrange cell array with the grouped sequence

>> C = {21,3,'1';31,2,'1 1';25,1,'2 2 1 1'} C = [21] [3] '1' [31] [2] '1 1' [25] [1] ...

13 días ago | 0

Answered

How to simplify code which reads multiple files

You don't need to repeat the entire code, just the dir call is enough: theFiles = [... dir(fullfile(myFolder, '*ABC*.csv')...

How to simplify code which reads multiple files

You don't need to repeat the entire code, just the dir call is enough: theFiles = [... dir(fullfile(myFolder, '*ABC*.csv')...

13 días ago | 0

| accepted

Answered

imshow not working when going from unit8 to double

Most likely because you did not scale the image when you converted the type. uint8 images are treated as having values from 0 t...

imshow not working when going from unit8 to double

Most likely because you did not scale the image when you converted the type. uint8 images are treated as having values from 0 t...

14 días ago | 0

| accepted

Answered

Looping a function with different inputs and storing multiple outputs.

The very simple solution is to loop over indices, and not over data (like you are doing): V1 = 0.5:1:2.5; % data! V2 = 0.5:1:2...

Looping a function with different inputs and storing multiple outputs.

The very simple solution is to loop over indices, and not over data (like you are doing): V1 = 0.5:1:2.5; % data! V2 = 0.5:1:2...

14 días ago | 1

| accepted

Answered

Save and Load .mat files with different names that numerically go up automatically. Maybe in a for loop?

"...as long as there is a way to load multiple of these in one go, without them all overwriting each other as fvalagg" This is ...

Save and Load .mat files with different names that numerically go up automatically. Maybe in a for loop?

"...as long as there is a way to load multiple of these in one go, without them all overwriting each other as fvalagg" This is ...

14 días ago | 1

| accepted

Answered

How to use cellfun?

fun = @(x,y) fminbnd(@(c0)objfunc(y,deg(c0,x,'other input parameters')),cm,cM); [C,V] = cellfun(fun,XM,YM,'Uni',0)

How to use cellfun?

fun = @(x,y) fminbnd(@(c0)objfunc(y,deg(c0,x,'other input parameters')),cm,cM); [C,V] = cellfun(fun,XM,YM,'Uni',0)

14 días ago | 1

| accepted

Answered

Anonymous function to calculate a sum

>> fun = @(x,n) x + sum(x.^(2:2:2*n) ./ factorial(2:2:2*n)); >> fun(3,5) ans = 12.066 Compare against your expansion: >> x ...

Anonymous function to calculate a sum

>> fun = @(x,n) x + sum(x.^(2:2:2*n) ./ factorial(2:2:2*n)); >> fun(3,5) ans = 12.066 Compare against your expansion: >> x ...

14 días ago | 2

| accepted

Answered

how to open such files "File B -ASCII" saved from MATLAB?

The -ASCII option saves a double array as a text file with space delimiters. This means: Any text editor can open that text fil...

how to open such files "File B -ASCII" saved from MATLAB?

The -ASCII option saves a double array as a text file with space delimiters. This means: Any text editor can open that text fil...

14 días ago | 1

| accepted

Answered

How to read rows of data in .csv file and turn them into arrays?

Notes to consider when importing a large file: Importing as character and then doing any kind of text manipulation before conve...

How to read rows of data in .csv file and turn them into arrays?

Notes to consider when importing a large file: Importing as character and then doing any kind of text manipulation before conve...

14 días ago | 0

| accepted

Submitted

Hyphenate

Word hyphenation using Franklin Mark Liang's algorithm (aka Knuth-Liang algorithm). Used in TeX.

15 días ago | 6 downloads |

Answered

Display Value of a Slider in a text box without GUIDE

If you want the slider to update something (text, plot, anything) as it moves, then you will need to add a listener: https://ww...

Display Value of a Slider in a text box without GUIDE

If you want the slider to update something (text, plot, anything) as it moves, then you will need to add a listener: https://ww...

15 días ago | 0

| accepted