フィルターのクリア

drop down gui help

1 回表示 (過去 30 日間)
A
A 2012 年 10 月 2 日
I need a drop-down menu to populate a vector. option 1: have user enter a single number(default is 1.5) and duplicate it to populate entire vector. option 2: open a file selection dialog to read in a delimited text file that specifies vector elements. Can you provide the gui command and callbacks for that?

回答 (1 件)

Image Analyst
Image Analyst 2012 年 10 月 3 日
For option %1, use GUIDE or uicontrol.
For option #2:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = 'C:\Program Files\MATLAB';
if ~exist(startingFolder, 'dir')
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
Then use dlmread, csvread, fgetl, or textscan to read in the numbers from the file.
  2 件のコメント
A
A 2012 年 10 月 15 日
I actually need to have user pick option 1 or option 2
Image Analyst
Image Analyst 2012 年 10 月 15 日
編集済み: Image Analyst 2012 年 10 月 15 日
So, use GUIDE and put either radio buttons or a "pop up" drop down list onto your GUI. Look here for a nice framework to get you started: MAGIC

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

カテゴリ

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