MATLAB: How to call the checkbox value in other checkbox

checkbox

My program has checkbox 1 and checkbox 2.
If checkbox 1 is selected and then checkbox 2 is selected, I want to make the message box pop up.
So I have to the call the checkbox1's value in function of checkbox2.
I tried to use 'get' at first, and then 'xlsread'. Because I saved the checkbox1's data to excel. But an error occurred and this code doesn't work.
It says XLSREAD could not open file 'name1.xls'. File xls Not found.
The code I upload now contains only the parts that are not error-prone.
What should I do?
function checkbox2_Callback(hObject, eventdata, handles)
if(get(handles.checkbox2,'Value'))
t2=clock;
DataString2=datestr(t2);
minusfine1=floor(((t2(4)-19)*60 + t2(5))/30)*1000;
if (minusfine1)>0
total1=fine1-minusfine1; %%%I need to call the value of fine1 which is checkbox1's value

f=msgbox({'Todays Total fine is',total1});
else
minusfine1=0;
total1=fine1-minusfine1; %%%I need to call the value of fine1 which is checkbox1's value
f=msgbox({'Todays Total fine is',total1});
end
xlswrite('name1.xlsx',minusfine1,'sheet1','B');
xlswrite('name1.xlsx',total1,'sheet1','C');
end

Best Answer

When you initialize the program, decide which directory the name1.xlsx is to be written into. Save that directory name into a variable that you make available Share . Later, when you want to refer to the file, recall that shared variable and fullfile() with it and the name of the file. (Be sure to take into account the possibility that the user might try to retrieve the file before it has been created.)