Effacer les filtres
Effacer les filtres

Matlab GUI

1 vue (au cours des 30 derniers jours)
Simone Leon
Simone Leon le 23 Oct 2011
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

Réponse acceptée

Image Analyst
Image Analyst le 23 Oct 2011
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???

Plus de réponses (0)

Catégories

En savoir plus sur Text Data Preparation dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by