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 CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by