Accessing the index of a matrix element inside the cell array
이전 댓글 표시
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
Stephen23
2019년 7월 1일
Note that square brackets are a concatenation operator, so your example
[ 'Node1' 'Node2' 'Node3']
is equivalent to:
'Node1Node2Node3'
채택된 답변
추가 답변 (1개)
Soumya Sinha
2019년 7월 1일
편집: Soumya Sinha
2019년 7월 1일
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
surendra kumar Aralapura mariyappa
2019년 7월 1일
Guillaume
2019년 7월 1일
@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
2019년 7월 1일
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!