show Command Window Application Designer, How can I display the Command Windows within App Designer?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
David Alejandro Ramirez Cajigas
el 23 de Jul. de 2021
Respondida: prabhat kumar sharma
el 2 de Mayo de 2024
How can I display the Command Windows within App Designer?
I have a code that I am programming, I need it to be executable on another pc, for that I can use the compilation app or the disegner app. but I need everything that comes out in the windows command to appear in a window or be printed when executing the code, as if it were the matlab workspace
0 comentarios
Respuestas (1)
prabhat kumar sharma
el 2 de Mayo de 2024
Hi David,
I understand you want to include the command window in the app designer application itself. In MATLAB App Designer, we cannot directly embed the Command Window within your app's GUI. However, you can simulate similar functionality by capturing output that would typically go to the Command Window and displaying it in a UI component, such as a TextArea. This approach requires redirecting or capturing the output from your functions and commands and then explicitly setting the text of the TextArea to display this output.
Here are the steps which you can follow:
1. Drag a TextArea component to your app's UI.
2.To capture output, you'll generally need to modify your functions or commands to return their output as strings, or you have to capture the output of built-in functions or commands that write to the Command Window.
For custom functions, modify them to return their output as a string or cell array of strings instead of displaying directly using disp or similar functions.
For capturing output from MATLAB functions or commands that write to the Command Window, you can use evalc. The evalc function captures the output of commands executed inside it. For example:
[T, result] = evalc('disp("Hello, World!")');
3. Display Output in TextArea
function myFunctionCallback(app, event)
% Example command
[T, result] = evalc('disp("Hello, World!")');
% Append the captured output to the TextArea
currentText = app.TextArea.Value;
app.TextArea.Value = [currentText; {result}];
end
You can use this workaround to get the desired functionality, I hope it helps!
0 comentarios
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!