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

17 ビュー (過去 30 日間)
Julius Rinaldi Simanungkalit
Julius Rinaldi Simanungkalit 2020 年 10 月 3 日
コメント済み: Mario Malic 2020 年 10 月 3 日
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 件のコメント
Mario Malic
Mario Malic 2020 年 10 月 3 日
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

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by