Matlab GUI

1 visualización (últimos 30 días)
Simone Leon
Simone Leon el 23 de Oct. de 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

Respuesta aceptada

Image Analyst
Image Analyst el 23 de Oct. de 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???

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by