Answered

Why am I not getting the plot results?

Because you missed the dot operators: https://in.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html The bel...

Why am I not getting the plot results?

Because you missed the dot operators: https://in.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html The bel...

7 giorni ago | 1

| accepted

Answered

sorted two different arrays

[~,idx]=sort(T{:,1}); % T your table C(idx,:) % C your cell become sorted according to first column of table T(idx,:) ...

sorted two different arrays

[~,idx]=sort(T{:,1}); % T your table C(idx,:) % C your cell become sorted according to first column of table T(idx,:) ...

7 giorni ago | 1

| accepted

Answered

Am getting the error ' Array indices must be positive integers or logical values.

xander = 1/n * h1 * (sum(kiki * (([m{:}] - numel(Test)/h1)))); % ^ missed

Am getting the error ' Array indices must be positive integers or logical values.

xander = 1/n * h1 * (sum(kiki * (([m{:}] - numel(Test)/h1)))); % ^ missed

8 giorni ago | 0

| accepted

Answered

Is the following sample mean and variance fully vectorised?

MATLAB already has inbuilt functions named <https://in.mathworks.com/help/matlab/ref/mean.html *mean()*> and <https://in.mathwor...

Is the following sample mean and variance fully vectorised?

MATLAB already has inbuilt functions named <https://in.mathworks.com/help/matlab/ref/mean.html *mean()*> and <https://in.mathwor...

8 giorni ago | 0

Answered

compare two matrix one by one number to eachother

% a = > first matrix % b = > second matrix sum(a==b) % each column -> tells the number of counts of each matrix's column compa...

compare two matrix one by one number to eachother

% a = > first matrix % b = > second matrix sum(a==b) % each column -> tells the number of counts of each matrix's column compa...

8 giorni ago | 1

| accepted

Answered

How to insert a new vector to matrix in every iteration?

Trivially done without a loop: out = [repelem(x,1:numel(x));repmat(y,1,numel(x))] With loop: x=1:3; y=4:5; ctr=1; out=zer...

How to insert a new vector to matrix in every iteration?

Trivially done without a loop: out = [repelem(x,1:numel(x));repmat(y,1,numel(x))] With loop: x=1:3; y=4:5; ctr=1; out=zer...

8 giorni ago | 1

| accepted

Answered

Swap first and last word in a string

Simpler: s = 'hello world'; Wanted = swap(s) % function call % function function Wanted = swap(str) S = regexp(str,'\S*'...

Swap first and last word in a string

Simpler: s = 'hello world'; Wanted = swap(s) % function call % function function Wanted = swap(str) S = regexp(str,'\S*'...

8 giorni ago | 0

Answered

How to read multiple .txt file in MATLAB ?

Files = dir('*.txt'); n = numel(Files); MAX = zeros(n,1); for k = 1:n MAX(k) = mean(reshape(load(Files(k)....

How to read multiple .txt file in MATLAB ?

Files = dir('*.txt'); n = numel(Files); MAX = zeros(n,1); for k = 1:n MAX(k) = mean(reshape(load(Files(k)....

8 giorni ago | 0

Answered

extract column name of table with Nan column

patients.Properties.VariableNames(all(isnan(patients{:,:})))

extract column name of table with Nan column

patients.Properties.VariableNames(all(isnan(patients{:,:})))

8 giorni ago | 0

| accepted

Answered

I don't know how to plot what answer of dsolve

syms y(x) Dy = diff(y); D2y = diff(y,2); k=3; % example f = dsolve(D2y==-(exp(-k^2))*y,y(0)==1,Dy(1)==0); fplot(f);

I don't know how to plot what answer of dsolve

syms y(x) Dy = diff(y); D2y = diff(y,2); k=3; % example f = dsolve(D2y==-(exp(-k^2))*y,y(0)==1,Dy(1)==0); fplot(f);

8 giorni ago | 0

Answered

Convert Cell to variable name array

A={'sample1' 'sample2' 'sample3'} ; a = array2table(rand(3)); % an example a.Properties.VariableNames=A

Convert Cell to variable name array

A={'sample1' 'sample2' 'sample3'} ; a = array2table(rand(3)); % an example a.Properties.VariableNames=A

8 giorni ago | 0

| accepted

Answered

Problem with university's licence

Contact your university's IT department.

Problem with university's licence

Contact your university's IT department.

8 giorni ago | 1

Answered

Ode45 iteration issue

[t1,X2]=deal(cell(numel(C1),1)); for k = 1:numel(C1) [t1{k},X2{k}] = ode45(@(t,x)fun(t,x,C1(k),C2(k),C3(k),C4(k)),t0,X01);...

Ode45 iteration issue

[t1,X2]=deal(cell(numel(C1),1)); for k = 1:numel(C1) [t1{k},X2{k}] = ode45(@(t,x)fun(t,x,C1(k),C2(k),C3(k),C4(k)),t0,X01);...

8 giorni ago | 0

| accepted

Answered

How to insert an unknown number of coloumn in a Matrix?

Try this: B=rand(3); % your initial matrix [m,n]=size(B); No_of_Columns=input('No of columns to be inserted') disp...

How to insert an unknown number of coloumn in a Matrix?

Try this: B=rand(3); % your initial matrix [m,n]=size(B); No_of_Columns=input('No of columns to be inserted') disp...

9 giorni ago | 0

| accepted

Answered

How can I set a matrix value to equal a non-numeric coordinate?

[a,b]=find(x==3)% I don't see the point of this if your assigning the same value x==3 % is already sufficient and efficient for...

How can I set a matrix value to equal a non-numeric coordinate?

[a,b]=find(x==3)% I don't see the point of this if your assigning the same value x==3 % is already sufficient and efficient for...

9 giorni ago | 0

Answered

accumulate in multiple array

splitapply(@(x) mean(x,2),Temp,findgroups(Day))

accumulate in multiple array

splitapply(@(x) mean(x,2),Temp,findgroups(Day))

9 giorni ago | 1

| accepted

Answered

Use values of array as indices for different array

D = A(sub2ind(size(A),repmat(C(:),1,size(B,2)),B))

Use values of array as indices for different array

D = A(sub2ind(size(A),repmat(C(:),1,size(B,2)),B))

9 giorni ago | 0

| accepted

Answered

Can you extract an element from an array in the same line as you create the array?

Why not? regexp(s,'\w*','match','once')

Can you extract an element from an array in the same line as you create the array?

Why not? regexp(s,'\w*','match','once')

9 giorni ago | 1

Answered

Problem when using fprintf

Look at hypot() if all(size(a) == size(b)) % change this too fprintf('Error: Input sizes are not equal\n') ...

Problem when using fprintf

Look at hypot() if all(size(a) == size(b)) % change this too fprintf('Error: Input sizes are not equal\n') ...

9 giorni ago | 0

Answered

Conditional statement of matrix

n=find(A==k) % no loop is needed if you want to know the instances of the satisfied condition

Conditional statement of matrix

n=find(A==k) % no loop is needed if you want to know the instances of the satisfied condition

10 giorni ago | 0

Answered

how to load .txt data into a function and use it as variables in matlab function

B % just call it function B % not if the file is input from outside the function then parameterize you function by prov...

how to load .txt data into a function and use it as variables in matlab function

B % just call it function B % not if the file is input from outside the function then parameterize you function by prov...

10 giorni ago | 0

| accepted

Answered

Saving all output of for loop

You don't need a loop , this is straight forward just vectorize your code: Note: The other answer doesnât show the importance o...

Saving all output of for loop

You don't need a loop , this is straight forward just vectorize your code: Note: The other answer doesnât show the importance o...

10 giorni ago | 1

Answered

Copying index positions to other matrices

B2(sub2ind(size(B),row,column))=NaN Why not directly use logical indexing from *isnan()* ?

Copying index positions to other matrices

B2(sub2ind(size(B),row,column))=NaN Why not directly use logical indexing from *isnan()* ?

10 giorni ago | 1

| accepted

Answered

deleting all rows from a table that contain a string

T(~all(strcmp(T{:,:},'empty'),2),:)

deleting all rows from a table that contain a string

T(~all(strcmp(T{:,:},'empty'),2),:)

10 giorni ago | 0

| accepted