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);endif((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
Best Answer