フィルターのクリア

Access index in cells.

3 ビュー (過去 30 日間)
Anders Jensen
Anders Jensen 2019 年 6 月 18 日
回答済み: Jan 2019 年 6 月 19 日
Hey!
I have stored a number of images in a cell that I have to access in app-designer.
I want to use the slider (and its value) to decide what picture I want to show, but I cant access it. It says:
"Brace indexing is not supported for variables of this type"
function PlotImages(app)
imshow(app.subImage,'Parent',app.AxChosenCell);
end
function Slide(app)
app.subImage = round(app.SliderChosenCell.Value);
app.subImage = app.subImage{app.SliderChosenCell.Value};
end
I have a 6x1 cell (containing 6 images (n x m))

回答 (2 件)

Aravind Ravikumar
Aravind Ravikumar 2019 年 6 月 19 日
What the error message means is that you cannot use {} to index your app.subImage because for that type of variable, {} indexing has no meaning. It looks like your code is expecting app.subImage to be a cell array. It is not. You'll have to see what round(app.SliderChosenCell.Value) is returning and use proper indexing.

Jan
Jan 2019 年 6 月 19 日
What ever app.subImage was before, after:
app.subImage = round(app.SliderChosenCell.Value);
it is a scalar number with an integer value. Then:
app.subImage = app.subImage{app.SliderChosenCell.Value};
cannot work.
"I have a 6x1 cell (containing 6 images (n x m))" - this is not clear. Which variable contained this cell array?

カテゴリ

Help Center および File ExchangeImages についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by