show Command Window Application Designer, How can I display the Command Windows within App Designer?
조회 수: 11 (최근 30일)
이전 댓글 표시
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
답변 (1개)
prabhat kumar sharma
2024년 5월 2일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!