Answered

Are these the same: set(0, ... and set(groot, ...

"Are these the same: set(0, ... and set(groot, ..." No, they are not the same. Not even close to being the same. Zero is a num...

Are these the same: set(0, ... and set(groot, ...

"Are these the same: set(0, ... and set(groot, ..." No, they are not the same. Not even close to being the same. Zero is a num...

8 jours ago | 0

| accepted

Answered

Dealing with flags that are really comments

6. Give feedback to TMW that suitably rated users need the ability to change thread object types (without changing their other p...

Dealing with flags that are really comments

6. Give feedback to TMW that suitably rated users need the ability to change thread object types (without changing their other p...

8 jours ago | 0

| accepted

Answered

Counting specific element in one column corresponding to unique elements in an another column

>> a = [1;1;1;1;1;2;2;2;2;2;3;3;4;4;4;5;5;5;5;5;5]; >> b = [1;1;-1;1;-1;-1;-1;-1;1;1;-1;1;1;-1;-1;1;1;-1;-1;1;1]; >> u = uniqu...

Counting specific element in one column corresponding to unique elements in an another column

>> a = [1;1;1;1;1;2;2;2;2;2;3;3;4;4;4;5;5;5;5;5;5]; >> b = [1;1;-1;1;-1;-1;-1;-1;1;1;-1;1;1;-1;-1;1;1;-1;-1;1;1]; >> u = uniqu...

8 jours ago | 0

Answered

How to use a data from time series (e.g.) in ode function?

You just need to get the numeric array out of the structure, e.g.: S = load('GasFlowRate_T.mat', 'Qg'); Qg = S.Qg;

How to use a data from time series (e.g.) in ode function?

You just need to get the numeric array out of the structure, e.g.: S = load('GasFlowRate_T.mat', 'Qg'); Qg = S.Qg;

8 jours ago | 1

Answered

How can I see if a number in my vector is also present in a another vector while in the same place as the previous vector

Just use eq, for example: >> code = 95617; >> guess = 32617; >> vc = num2str(code)-'0'; >> vg = num2str(guess)-'0'; >> idx...

How can I see if a number in my vector is also present in a another vector while in the same place as the previous vector

Just use eq, for example: >> code = 95617; >> guess = 32617; >> vc = num2str(code)-'0'; >> vg = num2str(guess)-'0'; >> idx...

8 jours ago | 0

Answered

Error in unziping files loop

You need to include the path in the filenames otherwise MATKAB does not know where to find those files, e.g.: unzip(fullfile(di...

Error in unziping files loop

You need to include the path in the filenames otherwise MATKAB does not know where to find those files, e.g.: unzip(fullfile(di...

9 jours ago | 0

| accepted

Answered

Cell array help with strings

>> x = {'Q';'N';'Q';'New';'Q';'N';'Q'}; >> y = 1+cumsum(strcmpi(x,'new')); >> z = strcmpi(x,'Q') | strcmpi(x,'L'); >> foo = @...

Cell array help with strings

>> x = {'Q';'N';'Q';'New';'Q';'N';'Q'}; >> y = 1+cumsum(strcmpi(x,'new')); >> z = strcmpi(x,'Q') | strcmpi(x,'L'); >> foo = @...

10 jours ago | 1

Answered

Using loop to label multiple outputs

No need for a loop: >> X = [11;22;33;44]; >> fprintf('X%u = %u\n',[1:numel(X);X(:).']); X1 = 11 X2 = 22 X3 = 33 X4 = 44 I...

Using loop to label multiple outputs

No need for a loop: >> X = [11;22;33;44]; >> fprintf('X%u = %u\n',[1:numel(X);X(:).']); X1 = 11 X2 = 22 X3 = 33 X4 = 44 I...

10 jours ago | 0

| accepted

Answered

Match strings from 2 tables

Method one: outerjoin (TC rows may be in a different order to TA): >> TC = outerjoin(TA,TB,'MergeKeys',true) TC = Name ...

Match strings from 2 tables

Method one: outerjoin (TC rows may be in a different order to TA): >> TC = outerjoin(TA,TB,'MergeKeys',true) TC = Name ...

10 jours ago | 1

| accepted

Answered

Error in unziping files and then deleting files in the zip

As its documentation clearly states, unzip's first input argument needs to be the name of a zip file. selpath is not the name o...

Error in unziping files and then deleting files in the zip

As its documentation clearly states, unzip's first input argument needs to be the name of a zip file. selpath is not the name o...

10 jours ago | 0

| accepted

Answered

How to save multiple files in a 'for' loop

Move the coordinate=[] line inside the first loop: for t = 1:numel(i) coordinate = []; ... the rest of your code end...

How to save multiple files in a 'for' loop

Move the coordinate=[] line inside the first loop: for t = 1:numel(i) coordinate = []; ... the rest of your code end...

10 jours ago | 0

| accepted

Answered

How to pull a range of values out of an array using a loop

MATLAB is not Java. Using a loop would be entirely the wrong approach in MATLAB. >> idx = tau < 1e8; >> acceptable = tau(idx);...

How to pull a range of values out of an array using a loop

MATLAB is not Java. Using a loop would be entirely the wrong approach in MATLAB. >> idx = tau < 1e8; >> acceptable = tau(idx);...

10 jours ago | 0

Answered

How to extract some rows from a matrix and put them in another matrix?

>> idx = ismember(Q,N,'rows'); >> Q(idx,:) = [] Q = 4 3 2 1

How to extract some rows from a matrix and put them in another matrix?

>> idx = ismember(Q,N,'rows'); >> Q(idx,:) = [] Q = 4 3 2 1

11 jours ago | 0

| accepted

Answered

I have to vectorize the following code. I have tried using vectorization but can't get the output as I require.

Your code is equivalent to this >> BB = num2cell(A(:)); >> BB(index,2) = BB(index); and checking against the output of your c...

I have to vectorize the following code. I have tried using vectorization but can't get the output as I require.

Your code is equivalent to this >> BB = num2cell(A(:)); >> BB(index,2) = BB(index); and checking against the output of your c...

11 jours ago | 0

Answered

Trying to find the function of x for 0<=x<=2L

Two changes: you defined x to contain exactly one value, which is not very useful for plotting. you were missing some multipli...

Trying to find the function of x for 0<=x<=2L

Two changes: you defined x to contain exactly one value, which is not very useful for plotting. you were missing some multipli...

11 jours ago | 1

| accepted

Answered

Accepting multiple inputs in the form of an array

mnv = 1; mxv = 100; vec = []; while numel(vec)~=6 || any(vec<mnv | vec>mxv) || any(mod(vec,1)) str = input('Enter six in...

Accepting multiple inputs in the form of an array

mnv = 1; mxv = 100; vec = []; while numel(vec)~=6 || any(vec<mnv | vec>mxv) || any(mod(vec,1)) str = input('Enter six in...

11 jours ago | 0

Answered

Quick conversion of a large (and with mixed data types) cell array into a numerical array

This is likely to be faster than str2double. Use a decimal point rather than a decimal comma for more speed. >> C = {'1170790,8...

Quick conversion of a large (and with mixed data types) cell array into a numerical array

This is likely to be faster than str2double. Use a decimal point rather than a decimal comma for more speed. >> C = {'1170790,8...

11 jours ago | 0

| accepted

Answered

How can I count the number of 1 after every element of the vector?

>> X = [1,1,1,1,0,0,1,1,0,1,0,1,0,0,1,1] X = 1 1 1 1 0 0 1 1 0 1 0 1 0 0 1 1 >> Z = cumsum([...

How can I count the number of 1 after every element of the vector?

>> X = [1,1,1,1,0,0,1,1,0,1,0,1,0,0,1,1] X = 1 1 1 1 0 0 1 1 0 1 0 1 0 0 1 1 >> Z = cumsum([...

11 jours ago | 1

| accepted

Answered

Invalid expression in reading the file

function [rR,CL,effi1] = import_cl_effi(general_data,16, 45); % ^^ ^^ Not v...

Invalid expression in reading the file

function [rR,CL,effi1] = import_cl_effi(general_data,16, 45); % ^^ ^^ Not v...

12 jours ago | 0

| accepted

Submitted

Round to Electronic Component Values

Round numeric array values to the best matching IEC 60063 resistor values (E-Series).

12 jours ago | 11 downloads |

Answered

output the ohms symbol

>> fprintf('The resistance for the given color bands is 26000 Ω\n') The resistance for the given color bands is 26000 Ω >> fpr...

output the ohms symbol

>> fprintf('The resistance for the given color bands is 26000 Ω\n') The resistance for the given color bands is 26000 Ω >> fpr...

12 jours ago | 0

| accepted

Answered

Can we sum lastletter of string?

>> A = '111n22'; >> B = '444m11'; >> C = '777n55'; >> sum(str2double(regexp({A,B,C},'\d$','match','once'))) % single ans = ...

Can we sum lastletter of string?

>> A = '111n22'; >> B = '444m11'; >> C = '777n55'; >> sum(str2double(regexp({A,B,C},'\d$','match','once'))) % single ans = ...

13 jours ago | 0

| accepted

Answered

How can ı choose a defined valuable when ı use input function

vn = input('please enter the vehicle name ','s'); switch upper(vn) case 'A' val = 0.5; case 'B' val...

How can ı choose a defined valuable when ı use input function

vn = input('please enter the vehicle name ','s'); switch upper(vn) case 'A' val = 0.5; case 'B' val...

13 jours ago | 1

| accepted

Answered

How can I store an Italic-font text in a file?

"How can I use fprintf to store a string in a file (( with ITALIC font ))?" You can't, because textfiles do NOT contain any for...

How can I store an Italic-font text in a file?

"How can I use fprintf to store a string in a file (( with ITALIC font ))?" You can't, because textfiles do NOT contain any for...

13 jours ago | 0

Answered

question on indexing: How to extract rows from a matrix that crossponds to certain values in another vector?

Just call find with its optional 2nd and 3rd input arguments to specify that you only want one result returned: >> n = 3; >> p...

question on indexing: How to extract rows from a matrix that crossponds to certain values in another vector?

Just call find with its optional 2nd and 3rd input arguments to specify that you only want one result returned: >> n = 3; >> p...

13 jours ago | 0

Answered

Finding a scalar to make two arrays as equal as possible.

Use mldivide: c = A(:) \ B(:) For example: >> A = rand(2,3); >> B = A*0.23; >> c = A(:) \ B(:) c = 0.23000

Finding a scalar to make two arrays as equal as possible.

Use mldivide: c = A(:) \ B(:) For example: >> A = rand(2,3); >> B = A*0.23; >> c = A(:) \ B(:) c = 0.23000

13 jours ago | 1

Answered

Matlab is skipping over my while loop.

"Matlab is skipping over my while loop and I do not know why." Because you told it to. Lets have a look at what values V and n...

Matlab is skipping over my while loop.

"Matlab is skipping over my while loop and I do not know why." Because you told it to. Lets have a look at what values V and n...

13 jours ago | 0

Answered

How to find the position of a row in an array

>> [~,Y] = ismember(S,R,'rows') Y = 3

How to find the position of a row in an array

>> [~,Y] = ismember(S,R,'rows') Y = 3

13 jours ago | 0

Answered

Transform char variable to matrix

Efficient solution: >> C = {'002,005';'002,003';'002,005'}; >> sscanf(sprintf('%s;',C{:}),'%f,%f;',[2,Inf]).' ans = 2 5...

Transform char variable to matrix

Efficient solution: >> C = {'002,005';'002,003';'002,005'}; >> sscanf(sprintf('%s;',C{:}),'%f,%f;',[2,Inf]).' ans = 2 5...

13 jours ago | 1

Answered

How to vectorize max / min number in row

>> max(A,[],2) ans = 2.0000 2.3333 2.6667 3.0000 3.5556 4.4444 5.3333 6.2222 7.1111 8.0...

How to vectorize max / min number in row

>> max(A,[],2) ans = 2.0000 2.3333 2.6667 3.0000 3.5556 4.4444 5.3333 6.2222 7.1111 8.0...

14 jours ago | 1

| accepted