Clear Filters
Clear Filters

Can't show values to GUI table

1 view (last 30 days)
Adryan Fauzi
Adryan Fauzi on 5 Jul 2023
Commented: Rik on 5 Jul 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 Comments
Rik
Rik on 5 Jul 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 on 5 Jul 2023
Can you share how you are initializing handles.resultTable?
As error suggests, it should be an UITable to work

Sign in to comment.

Answers (1)

Neev
Neev on 5 Jul 2023
Edited: Rik on 5 Jul 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 Comment
Rik
Rik on 5 Jul 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.

Sign in to comment.

Categories

Find more on Biomedical Signal Processing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!