How to run a custom command from a UI
이전 댓글 표시
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
"...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
2019년 12월 23일
편집: Guy Stimpson
2019년 12월 23일
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!