Hi,
I have some data, putting in a matrix A:-
Col1 = [1;4;0];
Col2 = [2;5;2];
Col3 = [3;6;4];
A = [Col1,Col2,Col3]
I want to extract the rows where column 2 have the value 2 (i.e. c), and also have another output with those values being updated from 2 to 200 (i.e. d).
b=(A(:,2)==2);
c=A(b,:)
d=A;
d(b,2)=200
However, now the data I obtained is a table, instead of a matrix:-
A2 = table(Col1,Col2,Col3)
I tried to use A2 to replace A in the above codes and try to obtain c and d, but I failed.
How can I obtain c and d? Many thanks!
1 Comment
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/415328-how-to-do-matching-in-table-format#comment_601206
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/415328-how-to-do-matching-in-table-format#comment_601206
Sign in to comment.