Effacer les filtres
Effacer les filtres

Can't show values to GUI table

1 vue (au cours des 30 derniers jours)
Adryan Fauzi
Adryan Fauzi le 5 Juil 2023
Commenté : Rik le 5 Juil 2023
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);
Unable to resolve the name 'handles.resultTable'.
  2 commentaires
Rik
Rik le 5 Juil 2023
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
Sandeep Mishra le 5 Juil 2023
Can you share how you are initializing handles.resultTable?
As error suggests, it should be an UITable to work

Connectez-vous pour commenter.

Réponses (1)

Neev
Neev le 5 Juil 2023
Modifié(e) : Rik le 5 Juil 2023
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);
Unable to resolve the name 'handles.resultTable'.
set(handles.resultTable, 'ColumnName', columnNames);
I got the an output as shown in below snippit.
I hope I was able to help you :)
  1 commentaire
Rik
Rik le 5 Juil 2023
@Neev, If you format your code as code, you can run it right from within the editor. That way you can show what should happen.
In this case you didn't show how you initialized the table, so the code works (or fails) exactly the same way the originally posted code does.

Connectez-vous pour commenter.

Catégories

En savoir plus sur EEG/MEG/ECoG dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by