dynamic GUI list box

3 ビュー (過去 30 日間)
Abolfazl Nejatian
Abolfazl Nejatian 2016 年 11 月 22 日
回答済み: Image Analyst 2016 年 11 月 23 日
Hey everyone
I’m new with Matlab GUI, so maybe my question isn’t suitable but really I need to know it
In part of my project I need to build a dynamic list box in Matlab GUI that show a specified path.
I use this Matlab sample code,
openExample('Matlab/InteractiveListBoxGUIDEExample').
this sample code work true individually but unfortunately when I mixed it with my code this error appears.
_Reference to non-existent field 'sorted_index'._
I’ve checked codes many times but I couldn’t understand the reason. Any help will be appreciated
Yours truly
Abolfazl Nejatian
  1 件のコメント
Walter Roberson
Walter Roberson 2016 年 11 月 22 日
We need to see your code; please attach it. Please also attach the .fig file if you used GUIDE

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

回答 (1 件)

Image Analyst
Image Analyst 2016 年 11 月 23 日
When you call dir() to get a list of files that you are going to load into the listbox, make sure you pass in the folder prepended to your file pattern. I haven't looked at your example but it would be something like:
% Get list of files in yourFolder.
fileList = dir(fullfile(yourFolder, '*.m'))
% Convert to cell array.
ca = struct2cell(fileList)
% Extract the base filenames (plus extensions) only and put into our listbox.
handles.lstVideoFiles.String = ca(1,:)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by