1 view (last 30 days)

Hey all.

I asked this question already, But I didn't get the solution I intended.

I have a cell array

A = { [ 2 4 6] ['Air'; 'oil'; 'Metal']}

Here I am putting a part of my code.

for count = 1:n

if whichnode = find(X{1} == count, 1)

if ~isempty(whichnode)

whichnode = count;

% here I need to find the indicies of the count, which(number) will be there in matrix of the cell A{1}, I know using this, for an example if count = 4, it's indicies is A{1}(1,2). %This I can write manually, but I can't write it for each input. So I need to find the indicies for any input in A{1} again. One more example, if count = 9, it's indicies should be given automatically before the plot function.

plot(f, T1, 'DisplayName', A{2})

end

end

end

Here my Idea is to get the indices of the count in the matrix of the cell array, before the solver enter the built in function plot.

The reason is, using that indicies, I can display the name of the plot easily with my idea.

I don't know whether it is possible or not!. But If we get the idea, there should be a way to do it. I need that way.

Any suggestions and answered are most welcomed!

Thanks in advance

Opportunities for recent engineering grads.

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

Start Hunting!
## 8 Comments

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_720416

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_720416

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_720433

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_720433

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_720597

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_720597

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_720676

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_720676

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_721120

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_721120

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_721139

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_721139

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_721216

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_721216

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_721324

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/469829-finding-the-indicies-of-the-cell-element#comment_721324

Sign in to comment.