Accessing the index of a matrix element inside the cell array
Show older comments
Hey all,
I have a small question in regarding the access of index of a matrix element inside the cell array.
A = {[1 2 3 4] [ 'Node1' 'Node2' 'Node3']};
Above is my cell array. Now I need to get the index of an element of matrix inside the cell array.
For an example if c = 3, just an example, c may be any number.
then I need it's index like A{1,1}(1,3)
Can anyone help me in this?
Thanks in advance
1 Comment
Stephen23
on 1 Jul 2019
Note that square brackets are a concatenation operator, so your example
[ 'Node1' 'Node2' 'Node3']
is equivalent to:
'Node1Node2Node3'
Accepted Answer
More Answers (1)
Soumya Sinha
on 1 Jul 2019
Edited: Soumya Sinha
on 1 Jul 2019
Hello Surendra,
Here in this case you have created a 1*2 Cell array in which first element is an array of numbers and the second one is the array of strings.
You can access the number 3 by writing the code
A{1,1}(3)
3 Comments
surendra kumar Aralapura mariyappa
on 1 Jul 2019
Guillaume
on 1 Jul 2019
@surendra,
Your code is working fine, so it's really not clear what problem you're having. It's not clear what you mean by the index of c (which is scalar).
surendra kumar Aralapura mariyappa
on 1 Jul 2019
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!