3,303 total contributions since 2018

Communication through MATLAB is always better than arguing.

Answered

How can i use a cell array in the symbolic variables?

Wanted = num2cell(symvar(B)) edit: After your comment. >> syms a b c d x y z >> A = [ a*(x^2) , b*(y^3) ; d*(x^2)*y , c ] ...

How can i use a cell array in the symbolic variables?

Wanted = num2cell(symvar(B)) edit: After your comment. >> syms a b c d x y z >> A = [ a*(x^2) , b*(y^3) ; d*(x^2)*y , c ] ...

약 4시간 ago | 1

Answered

How can we transpose a row vector into column vector in a cell

cellfun(@(x) x(:),A,'un',0)

How can we transpose a row vector into column vector in a cell

cellfun(@(x) x(:),A,'un',0)

약 6시간 ago | 0

| accepted

Answered

location of logical matrix

Since you have a logical matrix it’simply: ix=all(matrix ,2); % logical indexing is efficient Wanted=find(ix)

location of logical matrix

Since you have a logical matrix it’simply: ix=all(matrix ,2); % logical indexing is efficient Wanted=find(ix)

약 11시간 ago | 0

| accepted

Answered

surface Z contain more than one row or column

x1=0.0001:.001:.01; % you would have to decide the points yourself x2=0.003:0.001:0.08; [X,Y]=meshgrid(x1,x2); rho_ss=8000; ...

surface Z contain more than one row or column

x1=0.0001:.001:.01; % you would have to decide the points yourself x2=0.003:0.001:0.08; [X,Y]=meshgrid(x1,x2); rho_ss=8000; ...

1일 ago | 0

Answered

fprintf in if statement

if x == 1 % where x is assumed as a scalar fprintf('hello') end help if doc if

fprintf in if statement

if x == 1 % where x is assumed as a scalar fprintf('hello') end help if doc if

1일 ago | 0

| accepted

Answered

Matrix dimensions must agree problem.

tx1.*tx2(:) % error is gone who knows if the logic is right. times(tx1,tx2(:)) % bsxfun(@times,tx1,tx2(:)) if 2016a <

Matrix dimensions must agree problem.

tx1.*tx2(:) % error is gone who knows if the logic is right. times(tx1,tx2(:)) % bsxfun(@times,tx1,tx2(:)) if 2016a <

3일 ago | 0

Answered

how to convert a 3*3 matrix into 1*9 using for loop

reshape(matrix,1,[]) % no loops needed , the beauty of MATLAB is the tasks are far simpler than most think.

how to convert a 3*3 matrix into 1*9 using for loop

reshape(matrix,1,[]) % no loops needed , the beauty of MATLAB is the tasks are far simpler than most think.

4일 ago | 2

Answered

How does one accept an answer?

Only one answer can be accepted, as you have figured it out unaccepting and accepting the latter which you find useful for the n...

How does one accept an answer?

Only one answer can be accepted, as you have figured it out unaccepting and accepting the latter which you find useful for the n...

5일 ago | 1

| accepted

Answered

filling array with data

Abweichung=nan(size(Schlusskurs(:,1))); ii = T:-1:2; for k = 1:numel(ii) Abweichung(k) = log(Schlusskurs(ii(k)-1,1)/Schl...

filling array with data

Abweichung=nan(size(Schlusskurs(:,1))); ii = T:-1:2; for k = 1:numel(ii) Abweichung(k) = log(Schlusskurs(ii(k)-1,1)/Schl...

5일 ago | 0

Answered

Find mean of rows containing decimal numbers in between integers in a column

Y = [1 0.098 0.00076 0.01 2 0.099 0.007 2 0.003 0.04 0.1 4]; Y=Y(:); ix=diff(find(~mod(Y,1)))-1; assert(nnz(~mod(Y,1))>2,'atl...

Find mean of rows containing decimal numbers in between integers in a column

Y = [1 0.098 0.00076 0.01 2 0.099 0.007 2 0.003 0.04 0.1 4]; Y=Y(:); ix=diff(find(~mod(Y,1)))-1; assert(nnz(~mod(Y,1))>2,'atl...

5일 ago | 1

| accepted

Answered

Searching matrix which contain specific value?

any(matrix(:)==value) % 1 means true ,false otherwise

Searching matrix which contain specific value?

any(matrix(:)==value) % 1 means true ,false otherwise

5일 ago | 1

Answered

How to assign vectors to existing vector

newvector_2=vector_2; ix=nnz(~vector_2); v12=[vector_1,nonzeros(vector_2).']; u=unique(v12); d=setdiff(1:max(v12),v12); new...

How to assign vectors to existing vector

newvector_2=vector_2; ix=nnz(~vector_2); v12=[vector_1,nonzeros(vector_2).']; u=unique(v12); d=setdiff(1:max(v12),v12); new...

6일 ago | 0

Answered

maximum value of matrix

[Val,ix]=max(A(:)); [r,~]=ind2sub(size(A),ix); A(r,:) %complete row where maximum exists

maximum value of matrix

[Val,ix]=max(A(:)); [r,~]=ind2sub(size(A),ix); A(r,:) %complete row where maximum exists

6일 ago | 1

| accepted

Answered

.mlx with MATLAB mobile

<https://in.mathworks.com/products/matlab-mobile.html> - see under *Limitations*

.mlx with MATLAB mobile

<https://in.mathworks.com/products/matlab-mobile.html> - see under *Limitations*

6일 ago | 0

Answered

Datetime shows month name and not number

Change *InputFormat* to *Format*.

Datetime shows month name and not number

Change *InputFormat* to *Format*.

6일 ago | 0

| accepted

Answered

Storing the inputs of a function on a structure (or cell or array)

d=struct('x',1,'y',2); [z,w] = tempFun(d) function [z,w] = tempFun(s) z = s.x+1; w = s.y+1; end

Storing the inputs of a function on a structure (or cell or array)

d=struct('x',1,'y',2); [z,w] = tempFun(d) function [z,w] = tempFun(s) z = s.x+1; w = s.y+1; end

7일 ago | 0

| accepted

Question

How to append a field to an existing structure in a mat file?

s.a = rand; s.b = rand(2); save('s.mat','s') load s s.c = 'yes' save('s.mat','s') % now the new field is added Is there a...

7일 ago | 1 answer | 0

Question

Is there any other way to use coder for accumarray() ?

As stated in the documentation there are some limitations to some functions including accumarray(). Is there any other way to fe...

7일 ago | 1 answer | 0

Question

Which way is better?

Note: This is not about preallocating variable in a loop. This is for general case. For instance: a(10,10) = 10; % the rest ar...

7일 ago | 1 answer | 1

Answered

How to reshape every cell in a structure

arrayfun(@(x) reshape(b(x).a, 12, 4), 1:numel(b), 'UniformOutput', false)

How to reshape every cell in a structure

arrayfun(@(x) reshape(b(x).a, 12, 4), 1:numel(b), 'UniformOutput', false)

8일 ago | 0

| accepted

Answered

how to add a new column to a table. The length of the column is longer and want to add from the first row till the last row of current table and neglect the rest of the column

Wanted = [T1,T2(1:size(T1,1),:)] %T1 table with 500 rows and the other with 1000 rows

how to add a new column to a table. The length of the column is longer and want to add from the first row till the last row of current table and neglect the rest of the column

Wanted = [T1,T2(1:size(T1,1),:)] %T1 table with 500 rows and the other with 1000 rows

8일 ago | 0

| accepted

Answered

How to extract data to a matrix from cell arrays with varying cell lengths?

xy = cat(1,cell_array{:}); x = xy(:,1) y = xy(:,2)

How to extract data to a matrix from cell arrays with varying cell lengths?

xy = cat(1,cell_array{:}); x = xy(:,1) y = xy(:,2)

8일 ago | 0

Answered

How to reshape nested cell arrays in a table

t(:,2:4)=varfun(@(x) {reshape(x{:},4,12)},t(:,2:4))

How to reshape nested cell arrays in a table

t(:,2:4)=varfun(@(x) {reshape(x{:},4,12)},t(:,2:4))

8일 ago | 0

| accepted

Answered

Replace rows in one array with values from another column

v1(v1==5)=v2 % where v1 is array with 5s

Replace rows in one array with values from another column

v1(v1==5)=v2 % where v1 is array with 5s

8일 ago | 0

| accepted

Answered

pick up elements from a cell array and the result must be a cell array

cellfun(@(x) reshape(x(1:end-1),[],1), V,'un',0)

pick up elements from a cell array and the result must be a cell array

cellfun(@(x) reshape(x(1:end-1),[],1), V,'un',0)

8일 ago | 0