how can add an text on GUI
댓글 수: 1
Hi yasmeen,
Try using the uicontrol function to create a text area (uicontrol of style 'text'). Then, you can set the 'String' property of the text area to the data you want to display. Here is a simple example:
% Create a GUI figure
fig = figure;
% Create a text area
txt = uicontrol('Style', 'text', 'Position', [50, 50, 200, 100], 'String', 'Your Data Here');
% Update the text area with new data
new_data = 'New Data to Display';
set(txt, 'String', new_data);
So, in the above code snippet, I first created a GUI figure, then a text area with initial data. Later, I updated the text area with new data by setting the 'String' property of the text area. This approach will allow you to dynamically display data on a text area within your MATLAB GUI.
Note: When I executed the code using mobile Matlab, a warning message was displayed like the one shown below. However, the main point was to answer your question which was displaying data on a text area. Warning: In a future release, UI components will not be included in the output. To include UI components, use the exportapp function.
Please see attached result.

I hope this answers your question.
답변 (2개)
카테고리
도움말 센터 및 File Exchange에서 Labels and Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!