how to have a message that indicates me the experiment is done?
1 view (last 30 days)
Show older comments
Franck paulin Ludovig pehn Mayo
on 10 May 2022
Hello everyone,
İ would that when the ''Next button'' is done with the counter, it returns something like maybe a message saying that all the data have been used so the experiment is done.
Each time , i am clicking on the Next button, it is getting data from an excel file. İn another words, i am having 120 cases (drawing lines) in excel and i would like that after the 120 cases done , i should have a feedback that everything is done.
function franck_guide_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to franck_guide (see VARARGIN)
% Choose default command line output for franck_guide
handles.output = hObject;
% Plot patch on uiaxes
%hold on
% Read experiment data from a CSV file
[~,~,data] = xlsread('excel_datafff.xlsx');
data(1,:) = []; % remove the header line
% randomly permute the rows of data without repeating the value:
data = data(randperm(size(data,1)),:);
numeric_data = cell2mat(data(:,[1 2 3 4 6]));
handles.v_thickness_1 = numeric_data(:,1); % numeric
handles.v_thickness_2 = numeric_data(:,2);
handles.h_thickness_1 = numeric_data(:,3);
handles.h_thickness_2 = numeric_data(:,4);
handles.amplitude = data(:,5); % cell array of char vectors
handles.v_or_h_array = numeric_data(:,5);
handles.f_df = data(:,7);
handles.exp_counter = 1;
handles.region1 = [];
% Create the Arduino serial object
handles.arduinoObj = serialport('COM3', 38400);
configureTerminator(handles.arduinoObj,'CR/LF');
%
for i=1:8
handles.message = readline(handles.arduinoObj);
disp(handles.message)
end
create_patch(handles);
function Next_button_Callback(hObject, eventdata, handles)
% hObject handle to Next_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)uiconfirm(handles.UIFigure,'Are You sure?','Confirm Close',...
handles = guidata(hObject);
f = msgbox('Operation Completed','NEXT');
handles.exp_counter = handles.exp_counter + 1;
if handles.exp_counter > numel(handles.v_thickness_1)
return
end
% delete the old patch and create a new one:
create_patch(handles);
2 Comments
dpb
on 10 May 2022
That would be up to you coding something in the callback function that does the notification -- what would be entirely up to you.
It's not possible to make much of the code you posted; it doesn't appear either of those two functions is complete; we don't see any corresponding "end" statements to indicate the end of the function.
What is in the standalone calculation routine is really of no bearing for this purpose, we would need to see the complete callback structure that starts the process and then how it goes on to more until it is finished...and then how do you know it is finished? Is there a counted loop somewhere, a list of files to process obtained from a call to dir() or what???
Simply incomplete information...
Franck paulin Ludovig pehn Mayo
on 10 May 2022
Edited: Franck paulin Ludovig pehn Mayo
on 10 May 2022
Accepted Answer
Voss
on 10 May 2022
function Next_button_Callback(hObject, eventdata, handles)
% hObject handle to Next_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)uiconfirm(handles.UIFigure,'Are You sure?','Confirm Close',...
handles.exp_counter = handles.exp_counter + 1;
if handles.exp_counter > numel(handles.v_thickness_1)
msgbox('Experiment is Done!','DONE');
return
end
msgbox('Operation Completed','NEXT');
% delete the old patch and create a new one:
create_patch(handles);
0 Comments
More Answers (0)
See Also
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!