Matlab GUI
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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
추가 답변 (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!