MATLAB Answers

accessing cell data using brace indexing,

조회 수: 81(최근 30일)
Tijjani Aminu Kuda
Tijjani Aminu Kuda 2020년 1월 27일
답변: Image Analyst 2020년 1월 28일
Hi everyone,
I am tring to access the content of multiple cell in a loop. I have used the code:
for k = 1:length(predictors)
usg = predictors{k};
But it doesn't work. Instead I'm getting error that reads: Brace indexing not supported for this variable type. Could someone help please?
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 1월 28일
What shows up for

댓글을 달려면 로그인하십시오.


Catalytic 2020년 1월 28일
You need to check what predictors really is. It is not a cell array, as you believe.

Image Analyst
Image Analyst 2020년 1월 28일
The error is saying it's not a cell array like you think. It's something else, like a double or something. Where did it come from? Did some other function create it? If so, what?
See the FAQ for a good discussion of cell arrays. This should give you a good idea of where and when to use braces, parentheses, and brackets. Granted, it can be confusing. But I think reading the FAQ will help.

Community Treasure Hunt

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

Start Hunting!

Translated by