Can't show values to GUI table
1 次查看(过去 30 天)
显示 更早的评论
I did a first-order statistical calculation and I want to display the value I got in the gui table that I created with the resultTable tag, but the results of the calculation cannot appear in the table. here is the code i have made:
% Menghitung fitur statistik orde pertama
eeg_signal = randn(1, 1000); % Contoh sinyal EEG acak sepanjang 1000 data
% Menghitung fitur statistik orde pertama
mean_value = mean(eeg_signal); % Rata-rata
std_value = std(eeg_signal); % Standar deviasi
skewness_value = skewness(eeg_signal); % Skewness
kurtosis_value = kurtosis(eeg_signal); % Kurtosis
% Menampilkan hasil pada tabel GUI
data = {'Mean', mean_value; 'Standard Deviation', std_value; 'Skewness', skewness_value; 'Kurtosis', kurtosis_value};
set(handles.resultTable, 'Data', data);
2 个评论
Rik
2023-7-5
Why not? As you can see below, as long as handles.resultTable is a table UI component, your code should work.
handles.resultTable = uitable('Unit','Normalized','Position',[0 0 1 1]);
% Menghitung fitur statistik orde pertama
eeg_signal = randn(1, 1000); % Contoh sinyal EEG acak sepanjang 1000 data
% Menghitung fitur statistik orde pertama
mean_value = mean(eeg_signal); % Rata-rata
std_value = std(eeg_signal); % Standar deviasi
skewness_value = skewness(eeg_signal); % Skewness
kurtosis_value = kurtosis(eeg_signal); % Kurtosis
% Menampilkan hasil pada tabel GUI
data = {'Mean', mean_value; 'Standard Deviation', std_value; 'Skewness', skewness_value; 'Kurtosis', kurtosis_value};
set(handles.resultTable, 'Data', data);
Sandeep Mishra
2023-7-5
Can you share how you are initializing handles.resultTable?
As error suggests, it should be an UITable to work
回答(1 个)
Neev
2023-7-5
编辑:Rik
2023-7-5
Hey Adryan
I have reproduced your code to display it in a GUI Table as per your wish, you can find the code below and try running it.
This code worked on my system. The code is as follows:
% Menghitung fitur statistik orde pertama
eeg_signal = randn(1, 1000); % Contoh sinyal EEG acak sepanjang 1000 data
% Menghitung fitur statistik orde pertama
mean_value = mean(eeg_signal); % Rata-rata
std_value = std(eeg_signal); % Standar deviasi
skewness_value = skewness(eeg_signal); % Skewness
kurtosis_value = kurtosis(eeg_signal); % Kurtosis
% Menampilkan hasil pada tabel GUI
data = {'Mean', mean_value; 'Standard Deviation', std_value; 'Skewness', skewness_value; 'Kurtosis', kurtosis_value};
% Define the column names
columnNames = {'Feature', 'Value'};
% Set the data in the GUI table
set(handles.resultTable, 'Data', data);
set(handles.resultTable, 'ColumnName', columnNames);
I got the an output as shown in below snippit.
I hope I was able to help you :)
1 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 EEG/MEG/ECoG 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!