set uitable in a function matlab
显示 更早的评论
i have function call fungsiocr, this is my code to call that function
kandidatpelat=struct(a(11,:),value{1},a(12,:),value{2},a(13,:),value{3},a(14,:),value{4});
[ykandidatpelatf11 xkandidatpelatf11]=size(kandidatpelat.f11);
[ykandidatpelatf12 xkandidatpelatf12]=size(kandidatpelat.f12);
if((ykandidatpelatf11>0) && (xkandidatpelatf11>0))
Fungsiocr(kandidatpelat.f11,handles.mpengujiana1);
end
if((ykandidatpelatf12>0) && (xkandidatpelatf12>0))
Fungsiocr(kandidatpelat.f12,handles.mpengujiana2);
end
and my code in a function
function colorImage=Fungsiocr(datacitrargb,dataaxes)
colorImage=datacitrargb;
results = ocr(colorImage,'CharacterSet','0123456789QWERTYUIOPLKJHGFDSAZXCVBNM');
final_output=[];
final_output=[final_output deblank(results.Text)];
axes(dataaxes);
imshow(Img_Awal);
title(strcat('Detected Text : ',final_output));
i want to set database in that function with this code
%%Database
data_plat = load('Data_Plat.mat');
Database_All = data_plat.Database_All;
data2 = table2cell(Database_All(strcmpi(Database_All.Plat, final_output), ...
{'Plat', 'Nama', 'Jurusan', 'Status'}));
data2 = [get(handles.uitable1, 'Data'); data2];
data2(all(cellfun('isempty',data2),2),:) = [];
[~,idx]=unique(cell2table(data2),'rows');
unique_data2 = data2(idx,:);
set(handles.uitable1, 'Data', unique_data2);
the question is, how can i do that?, that always get error Undefined variable "handles" or class "handles.uitable1", because i want put that code in a function, any suggestion what can i do to solve my problem?? i want to procces every data to always set up in table when i call that function
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Scope Variables and Generate Names 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!