How do I display my mean values in GUIDE?

2 ビュー (過去 30 日間)
Chen Liang Teoh
Chen Liang Teoh 2021 年 11 月 30 日
回答済み: Image Analyst 2021 年 12 月 28 日

回答 (2 件)

Cris LaPierre
Cris LaPierre 2021 年 12 月 28 日
You need to use a component like label or edit_field that can display text to the user, and then set that component's text/value/string property (depends on the component) equal to the mean value you calculated.

Image Analyst
Image Analyst 2021 年 12 月 28 日
Make static text labels with tags of txtData, txtData1, txtData2, and txtData3. Then compute the means, make strings with the information in them with sprintf(), then send the strings to the static text label controls.
% Compute the 4 means and save/store them as new fields of the handles structure.
handles.dataMean = mean(handles.data);
handles.dataMean1 = mean(handles.data1);
handles.dataMean2 = mean(handles.data2);
handles.dataMean3 = mean(handles.data3);
% Create static text strings "txt" and then
% send that string into the respective static text label controls.
txt = sprintf('Data mean = %f', handles.dataMean);
handles.txtData.String = txt;
txt = sprintf('Data1 mean = %f', handles.dataMean1); % Can re-use variable txt if you want.
handles.txtData1.String = txt;
txt = sprintf('Data2 mean = %f', handles.dataMean2);
handles.txtData2.String = txt;
txt = sprintf('Data3 mean = %f', handles.dataMean3);
handles.txtData3.String = txt;

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by