Dot indexing is not supported for variables of this type+ App designer

5 ビュー (過去 30 日間)
Medical Imaging
Medical Imaging 2020 年 7 月 28 日
コメント済み: Medical Imaging 2020 年 7 月 29 日
At below line, I am getting error: "Dot indexing is not supported for variables of this type." what could be the possible reason?
app.idx = listdlg('ListString', {sFOLDERS(:).name}, 'SelectionMode', 'single', ...
'ListSize', [160,90]*4);
here sFOLDER is defined as;
app.sFOLDERS = dir(PTH);
app.sFOLDERS = app.sFOLDERS(...
[app.sFOLDERS.isdir] & ...
~strcmp({app.sFOLDERS.name},'.') & ... % to remove entry '.'
~strcmp({app.sFOLDERS.name},'..') ); % and entry '..'

採用された回答

Jon
Jon 2020 年 7 月 28 日
編集済み: Jon 2020 年 7 月 28 日
Usually when I unexpectedly get that error message it is because the object is empty. Are you sure there are folders that match your criteria. Otherwise maybe app.sFOLDERS is empty. You can explicitly check using the isempty function
Also, maybe I didn't read your code carefully enough but in that first line
app.idx = listdlg('ListString', {sFOLDERS(:).name}, 'SelectionMode', 'single', ...
'ListSize', [160,90]*4);
should that be app.sFOLDERS(:).name, rather than just sFOLDERS(:)?
By the way, you can format your code nicely in your question by using the code button in the Answers toolbar
  1 件のコメント
Medical Imaging
Medical Imaging 2020 年 7 月 29 日
Thank you for the suggestion. I believe app.sFOLDERS(:).name should be there. I will try and check on that. The code section seems good to incorporate in message section. Appreciated.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by