How to run a custom command from a UI
Show older comments
Hi,
I'm designing a UI for plotting various instrumental data. However, I'd like to have a text field in which the user can enter any Matlab command they want and have it executed, as if they were using the Matlab console. The command would be entered as standard Matlab syntax, and would be processed as follows:
function SomeButtonPushed(app, event)
command = app.aTextField.Value;
% Some code to execute command
end
I would also like to get the console output (or whatever equivalent) in terms of error messages etc.
Is this possible? If so, how should I go about it?
Many thanks in advance.
2 Comments
"...in which the user can enter any Matlab command they want and have it executed..."
Does this include, for example, commands like (pseudocode):
system format my entire harddrive
quit MATLAB
delete everything in the workspace
reallocate any variable used in your code
system uninstall MS Office
"Is this possible? If so, how should I go about it?"
evalc
Guy Stimpson
on 23 Dec 2019
Edited: Guy Stimpson
on 23 Dec 2019
Accepted Answer
More Answers (1)
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!