Can't show values to GUI table

1 visualización (últimos 30 días)
Adryan Fauzi
Adryan Fauzi el 5 de Jul. de 2023
Comentada: Rik el 5 de Jul. de 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 comentarios
Rik
Rik el 5 de Jul. de 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 el 5 de Jul. de 2023
Can you share how you are initializing handles.resultTable?
As error suggests, it should be an UITable to work

Iniciar sesión para comentar.

Respuestas (1)

Neev
Neev el 5 de Jul. de 2023
Editada: Rik el 5 de Jul. de 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 comentario
Rik
Rik el 5 de Jul. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre EEG/MEG/ECoG en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by