Suspensa Vix Via Fit

Answered

How to generate a random decimal number between -1 and 1?

The inputs to rand define its output size, not the output value range. Its range is fixed to 0..1, but you can adjust generate o...

How to generate a random decimal number between -1 and 1?

The inputs to rand define its output size, not the output value range. Its range is fixed to 0..1, but you can adjust generate o...

environ 15 heures ago | 0

| accepted

Answered

coverting string to ascii value in Matlab

"the letter 'a' is 61 why in matlab i get NAN?" Because that is the wrong way to get the ASCII value (or character code, to be ...

coverting string to ascii value in Matlab

"the letter 'a' is 61 why in matlab i get NAN?" Because that is the wrong way to get the ASCII value (or character code, to be ...

1 jour ago | 0

Answered

Operator '==' is not supported for operands of type 'cell'.

Use strcmpi instead of testing for character equality.

Operator '==' is not supported for operands of type 'cell'.

Use strcmpi instead of testing for character equality.

2 jours ago | 1

Answered

Sorting Vector A in Ascending order and apply the same steps to Vector B

[A,X] = sort(A) B = B(X)

Sorting Vector A in Ascending order and apply the same steps to Vector B

[A,X] = sort(A) B = B(X)

2 jours ago | 0

Answered

Subtracting 2 cells in an array

>> -diff(A) ans = -2 -2 3 -4 5 >> sum(-diff(A)) ans = 0

Subtracting 2 cells in an array

>> -diff(A) ans = -2 -2 3 -4 5 >> sum(-diff(A)) ans = 0

2 jours ago | 0

| accepted

Answered

Format Array column in fprintf

The short answer is: not easily. Your output example has varying numbers of fractional digits 0.000000 % six decimal places 4...

Format Array column in fprintf

The short answer is: not easily. Your output example has varying numbers of fractional digits 0.000000 % six decimal places 4...

3 jours ago | 0

| accepted

Answered

Preallocating a cell array of chars?

A = cell(3,1); A(:) = {''} This assigns one scalar cell (on the RHS) to all of the cells in the array A: https://www.mathwork...

Preallocating a cell array of chars?

A = cell(3,1); A(:) = {''} This assigns one scalar cell (on the RHS) to all of the cells in the array A: https://www.mathwork...

3 jours ago | 0

| accepted

Answered

Format number in fprintf

I am guessing that unlike your example you actually want the columns to be aligned, e.g. where M is your matrix: >> fprintf(' %...

Format number in fprintf

I am guessing that unlike your example you actually want the columns to be aligned, e.g. where M is your matrix: >> fprintf(' %...

3 jours ago | 0

| accepted

Answered

How do I replace Matrix elements

Use AND instead of OR: >> A = [-1,0,4,6;1,1,0,2;-7,0,5,0;5,1,5,1] A = -1 0 4 6 1 1 0 2 -7 0 5 0 ...

How do I replace Matrix elements

Use AND instead of OR: >> A = [-1,0,4,6;1,1,0,2;-7,0,5,0;5,1,5,1] A = -1 0 4 6 1 1 0 2 -7 0 5 0 ...

3 jours ago | 0

Answered

How can I get the secondary diagonal of a matrix?

diag(fliplr(A))

How can I get the secondary diagonal of a matrix?

diag(fliplr(A))

3 jours ago | 0

| accepted

Answered

Find words common across multiple string cells

My ancient version does not support strings, so I used cell arrays of character vectors, but I would expect that this should wor...

Find words common across multiple string cells

My ancient version does not support strings, so I used cell arrays of character vectors, but I would expect that this should wor...

3 jours ago | 0

| accepted

Answered

Function with Non Constant Variable

You could create an anonymous function: fun = @(x) S(3,1,x,2); .. fun(17)

Function with Non Constant Variable

You could create an anonymous function: fun = @(x) S(3,1,x,2); .. fun(17)

3 jours ago | 0

Answered

How can I change the first row of my matrix to all 0s using a for loop?

Where M is your matrix: M(1,:) = 0;

How can I change the first row of my matrix to all 0s using a for loop?

Where M is your matrix: M(1,:) = 0;

3 jours ago | 0

Answered

How to form a structure array variable?

Simpler using indexing: vec = {'a','b','c'}; Test{1}.(vec{Ind}) https://www.mathworks.com/help/matlab/matlab_prog/generate-fi...

How to form a structure array variable?

Simpler using indexing: vec = {'a','b','c'}; Test{1}.(vec{Ind}) https://www.mathworks.com/help/matlab/matlab_prog/generate-fi...

3 jours ago | 0

Answered

How to I create a function handle through recursion?

I don't see any reason why you need any recursion, basic vectorized code works just fine: V = 0:size(A,1)-1; F = sum(A(:,1).*t...

How to I create a function handle through recursion?

I don't see any reason why you need any recursion, basic vectorized code works just fine: V = 0:size(A,1)-1; F = sum(A(:,1).*t...

3 jours ago | 1

| accepted

Answered

Automatisation of .mat files load and storing into a matrix

N = 20; C = cell(1,N); for k = 1:N F = sprintf('dx00%d.mat',k); S = load(F); C(k) = struct2cell(S); % if there ...

Automatisation of .mat files load and storing into a matrix

N = 20; C = cell(1,N); for k = 1:N F = sprintf('dx00%d.mat',k); S = load(F); C(k) = struct2cell(S); % if there ...

4 jours ago | 0

Answered

Importing files in the right order

"Any simpel way to make this happen?" Method one: The simplest way is to rename the files with sufficient leading zeros, e.g. ...

Importing files in the right order

"Any simpel way to make this happen?" Method one: The simplest way is to rename the files with sufficient leading zeros, e.g. ...

4 jours ago | 0

| accepted

Answered

saving workspace of each pair of variable in a loop

for ii = 1:numel(X) for jj = 1:numel(Y) ... your code fnm = sprintf('workspace_%d_%d.mat',ii,jj); ...

saving workspace of each pair of variable in a loop

for ii = 1:numel(X) for jj = 1:numel(Y) ... your code fnm = sprintf('workspace_%d_%d.mat',ii,jj); ...

4 jours ago | 0

| accepted

Answered

Matrix comparison with unequal sized matrices

N = nnz(B(1:end-1)>A(2:end)) Tested: >> A = randi(9,1,5) A = 2 5 7 2 6 >> B = randi(9,1,5) B = 3 9 5 ...

Matrix comparison with unequal sized matrices

N = nnz(B(1:end-1)>A(2:end)) Tested: >> A = randi(9,1,5) A = 2 5 7 2 6 >> B = randi(9,1,5) B = 3 9 5 ...

4 jours ago | 0

| accepted

Answered

Why a matrix multiply a variable and then be divided by the same variable produce different results?

"I am confused by the code show above, b is just a number, so why the matrix multiply b and then divide the same b (line 5) woul...

Why a matrix multiply a variable and then be divided by the same variable produce different results?

"I am confused by the code show above, b is just a number, so why the matrix multiply b and then divide the same b (line 5) woul...

4 jours ago | 1

| accepted

Answered

find text in text file

>> T = readtable('temp0.txt','Delimiter','\t','ReadVariableNames',false) T = Var1 Var2 Var3 __________ ...

find text in text file

>> T = readtable('temp0.txt','Delimiter','\t','ReadVariableNames',false) T = Var1 Var2 Var3 __________ ...

4 jours ago | 0

Answered

Unknown error in my m.function

There are a few combinations of values for which your function does not define the output argument. If you call the function wit...

Unknown error in my m.function

There are a few combinations of values for which your function does not define the output argument. If you call the function wit...

4 jours ago | 0

| accepted

Answered

How to turn off text interpreter when plotting timeseries objects

One approach would be to set the interpreter for the entire figure before plotting (and reset it again afterwards): https://www...

How to turn off text interpreter when plotting timeseries objects

One approach would be to set the interpreter for the entire figure before plotting (and reset it again afterwards): https://www...

4 jours ago | 0

| accepted

Answered

I have multiple files. I need to combine info in the files.

As Rik suggested: av = a(:); bv = b(:); [X,Y] = ndgrid(1:10); M = [av(X(:)),bv(Y(:))]

I have multiple files. I need to combine info in the files.

As Rik suggested: av = a(:); bv = b(:); [X,Y] = ndgrid(1:10); M = [av(X(:)),bv(Y(:))]

5 jours ago | 0

| accepted

Answered

reshape vector to matrix

A general solution for an arbitrary number of rows and columns: >> d = [1,2,3,4,5]; >> r = 4; >> m = hankel(d(1:4),d(r:end)) ...

reshape vector to matrix

A general solution for an arbitrary number of rows and columns: >> d = [1,2,3,4,5]; >> r = 4; >> m = hankel(d(1:4),d(r:end)) ...

5 jours ago | 0

| accepted

Answered

combination of tables across columns

Where T1 and T2 are your two tables: T = [T1,T2]; T = T(:,[1,4,2,5,3,6])

combination of tables across columns

Where T1 and T2 are your two tables: T = [T1,T2]; T = T(:,[1,4,2,5,3,6])

5 jours ago | 0

| accepted

Answered

Not enough input arguments

"Why is it said not enough input arguments at momentum1 = zeros(size(W1)); ?" Because you called the function without any input...

Not enough input arguments

"Why is it said not enough input arguments at momentum1 = zeros(size(W1)); ?" Because you called the function without any input...

5 jours ago | 0

Answered

A loop for sorting tables

tblA = sortrows(Table1,{'Variable','Value'}); for k = 1:40 % or whatever the max 'variable' is. vnm = sprintf('Variable %d...

A loop for sorting tables

tblA = sortrows(Table1,{'Variable','Value'}); for k = 1:40 % or whatever the max 'variable' is. vnm = sprintf('Variable %d...

7 jours ago | 1

| accepted

Answered

I there a way to call variables from my workspace into the genetic algorithm tool? (Without calling them from the fitness function)

"Is it possible to have variables in my fitness function (data.Die and data.DiePD in my case) that are in my worspace without ha...

I there a way to call variables from my workspace into the genetic algorithm tool? (Without calling them from the fitness function)

"Is it possible to have variables in my fitness function (data.Die and data.DiePD in my case) that are in my worspace without ha...

7 jours ago | 1

| accepted

Answered

using a value to find index in a matrix?

The simplest solution is to simply check for equality: idx = x==Matrix_A; which will return a logical array with true in every...

using a value to find index in a matrix?

The simplest solution is to simply check for equality: idx = x==Matrix_A; which will return a logical array with true in every...

7 jours ago | 0

| accepted