3.298 total contributions since 2018

Communication through MATLAB is always better than arguing.

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 <

1 giorno 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.

2 giorni 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...

3 giorni 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...

3 giorni 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...

3 giorni 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

3 giorni 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...

4 giorni 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

4 giorni 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*

4 giorni 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*.

4 giorni 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

5 giorni ago | 0

| accepted

Answered

how to construct a cell array from another cell array

V1={[1 2 3 4],[3 4 1 0],[3 5 -1 -9]}; V2={[-1 -2 9],[0 9 6]}; [m,n]=deal(numel(V1),numel(V2)); A =cell(m,n); for k = 1:m ...

how to construct a cell array from another cell array

V1={[1 2 3 4],[3 4 1 0],[3 5 -1 -9]}; V2={[-1 -2 9],[0 9 6]}; [m,n]=deal(numel(V1),numel(V2)); A =cell(m,n); for k = 1:m ...

5 giorni ago | 0

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...

5 giorni 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...

5 giorni 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...

5 giorni 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)

6 giorni 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

6 giorni 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)

6 giorni 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))

6 giorni 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

6 giorni 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)

6 giorni ago | 0

Answered

Call pts with z value within a range

z = A(:,3); result_B = A((z>1)&(z<9),:)

Call pts with z value within a range

z = A(:,3); result_B = A((z>1)&(z<9),:)

6 giorni ago | 0

| accepted

Question

Why does gpuArray() error out?

What does the error mean? >> A = gpuArray( rand(1024) ); There is a problem with the graphics driver or with this GPU device...

7 giorni ago | 1 answer | 0

Answered

selecting specific layers in the 3rd dimension of a matric

squeeze(mean(A(:,:,43:53)))

selecting specific layers in the 3rd dimension of a matric

squeeze(mean(A(:,:,43:53)))

7 giorni ago | 0

| accepted

Answered

Transferring cell array elements into a matrix

test_ca = {[1 2 3],[4 5 6];[7 8 9],[10 11 12]} .'; new_mat = cat(1,test_ca{:})

Transferring cell array elements into a matrix

test_ca = {[1 2 3],[4 5 6];[7 8 9],[10 11 12]} .'; new_mat = cat(1,test_ca{:})

7 giorni ago | 0

| accepted

Answered

How can I shift a vector numerically to the right (or the left) by adding zeros to the side of the array?

x1=[zeros(1,2),x]

How can I shift a vector numerically to the right (or the left) by adding zeros to the side of the array?

x1=[zeros(1,2),x]

8 giorni ago | 0

| accepted