フィルターのクリア

Matlab GUI

1 回表示 (過去 30 日間)
Simone Leon
Simone Leon 2011 年 10 月 23 日
I am creating a matlab gui and I have two problems I would like to solve: Problem 1 I would like to use a push button to load some data from a matlab file loacted on the C drive to the workspace. The variable name is 'MyData' and the location of the file is C:\Simulation\LoadFile.
Problem 2 While a simulation is running in matlab, I would like to view the contents of the command window in an edittext box in the Matlab GUI simultaneously. Is this possible? Presently I have to switch to the command view to see when the simulation is complete. I just want to stay on the GUI and view the contents.
Thank you for any assistance you can give

採用された回答

Image Analyst
Image Analyst 2011 年 10 月 23 日
1. In the callback construct the filename, check to see if it exists, then read it in.
% Get the full filename, with path prepended. fullFileName = fullfile('C:\Simulation\LoadFile', MyData);
if ~exist(fullFileName, 'file')
% Didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
% Now, read in the file in whatever way you do it.
Problem 2: Why not just use sprintf() to construct some string, then use set() to set the 'String' property of a static text to be that string? Why mess with the command window at all???

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by