Cannot display text from uitable1 to uitable 2 (column 1)

20 vues (au cours des 30 derniers jours)
Julius Rinaldi Simanungkalit
Commenté : Mario Malic le 3 Oct 2020
function UpdateTrain_Callback(hObject, eventdata, handles)
%% Tombol Update Train
try
data = get(handles.uitable1,'data');
%jenis = char(data(:,1));
DataJ = string(data);
[Alternatif, Kriteria] = size(data);
dataN = zeros(1,6);
DataTraining = str2num(get(handles.tfDataTraining,'String'));
newAlternatif=1;
for x = 1:DataTraining
for y = 1:Kriteria
dataN(x,y) = DataJ(newAlternatif,y);
%fprintf('\nData Testing Bulan Ke - %d Tahun Ke - %d = %10.8f', y, th2, dataN(x,y));
end
newAlternatif=newAlternatif+1;
end
disp(dataN);
if all(cellfun(@isempty, data(:)))
msgbox('Data Is Still Empty','Warning','warn');
elseif isempty(DataTraining)
msgbox('Data Training Cannot Be Empty','Information','help');
elseif all(~cellfun(@isempty, data(:))) && ~isempty(DataTraining)
set(handles.uitable2, 'enable','on');
set(handles.uitable2,'data',dataN);
set(handles.UpdateTest, 'enable','on');
end
catch exception
msgbox(exception.identifier,'Error','error');
end
Someone please help me. I don't know how to fix this .... and I don't really know what matlab does.
this is the source code ....
I can't display text from uitable1 (column 1) to uitable 2 (column 1)
The explanation is in the picture!
  1 commentaire
Mario Malic
Mario Malic le 3 Oct 2020
This happens when you try to put a character/string array into a field that accepts a numeric value. Not sure if it's possible to change UITable field with set command, but if you access it this way, it should work.
table.data = values

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur App Building 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