Load Button GUI trouble
1 回表示 (過去 30 日間)
古いコメントを表示
I am using GUIDE, but I cannot reconcile how to get the push button "Load Data" to bring a "browse" window up. How to do it with using this code as a start?
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
0 件のコメント
採用された回答
Evan
2013 年 7 月 3 日
編集済み: Evan
2013 年 7 月 3 日
help uigetfile
Put uigetfile in the callback of your pushbutton (the code you copy+pasted here). For info on how to specify outputs, limit your search to certain filetypes/directories, etc., read the help page for uigetfile.
4 件のコメント
Evan
2013 年 7 月 8 日
Assuming your text file is three simply columns divided by spaces and nothing else (e.g. no text to remove), the following code should be a good starting point to help you load it in:
[filename,pathname] = uigetfile('*.txt')
fullpath = fullfile(pathname,filename);
fid = fopen(fullpath);
t = textscan(fid,'%d %d %d');
That will load in your data as a 1x3 cell array. Each cell will be a column. All you have to do then is access each cell and plot the data on your axes.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!