MATLAB Answers

Accessing the indicies of an element of matrix in cell array

1 view (last 30 days)
Hey all,
Hope this time i will get a solution to my problem at least.
A = {[22,40,46],['Node22';'Node40';'Node46'] };
s = 40
% may be conversion need here to get only row and col. P = cell2mat(A{1});
%nA = numel(A);
n = 50;
Match = cell(1, n);
for i = 1:n
[row,col] = find(P == s,1);
%match{iA} = [row,col];
end
Here How can I access the row and col, for an example I need to get row and col separately or together when the number is 40
i.e P(1,2)
I think it is possible by converting cell2mat(A{1}). I just need to get the row and col elements of first matrix in a cell array. for an example A = [1 2 3 5], we can get the idex of 5 is A(1,4). But I am not an expert to figure it out how it is?
I don't know whether it is weird question or not!
Thanks in advance

Answers (0)

Products


Release

R2014a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!