%visualisation and data storage function[]=demo3(hObject,filenums,calibrationtr,handles) % ------------------------------------------------------------- % Initialisatie Labjack ljud_LoadDriver; ljud_Constants; [Error ljHandle]=ljud_OpenLabJack(LJ_dtU3,LJ_ctUSB,'1',1); % Verkrijg handle voor U3 ljud_ePut(ljHandle, LJ_ioPIN_CONFIGURATION_RESET, 0, 0, 0); % Zet alle poorten in default mode % %Set Device Resolution to 17. (Greater than 16 equals max resolution) % Error = ljud_AddRequest(ljHandle,LJ_ioPUT_CONFIG,LJ_chAIN_RESOLUTION,12,0,0); % Error_Message(Error) % % % Set Device Voltage Range to polar 2.5 volts for AIN0. % Error = ljud_AddRequest(ljHandle,LJ_ioPUT_AIN_RANGE,0,LJ_rgUNI2P5V,0,0); % Error_Message(Error) ljud_ePut(ljHandle,LJ_ioPUT_ANALOG_ENABLE_PORT,0,4095,16); % Definieer poort 1-10 to analog and all others to digital.INPUT IS BINAIR Error = ljud_AddRequest(ljHandle, LJ_ioGET_AIN, 4, 0, 0, 0); Error_Message(Error) Error = ljud_AddRequest(ljHandle, LJ_ioGET_AIN, 5, 0, 0, 0); Error_Message(Error) % Execute above request Error = ljud_GoOne(ljHandle); Error_Message(Error) if~isempty(calibrationtr); if ~isempty(filenums); %% Video initialisation %% Nog opschonen i=1; tic; t=0; % Initialize location in GUI or seperate figure %axes(handles.axes100); figure(2) % change properties of figure to match the rest of the layout set(figure(2),'MenuBar','none') set(figure(2),'units','centimeters') set(figure(2),'Color',[0.639 0.827 0.988]) set(figure(2),'position',[ 9 3 15 12]) %% Loop tic counter = 0; % init counter t(1)=0 while get(hObject,'value')== 1 % Timing... counter = counter + 1; % increment loop counter t(i+1)=toc; i=i+1; % Retrieve value from labjack device (U3) Error = ljud_GoOne(ljHandle); Error_Message(Error) % ------------------------------------------------------------- % ------------------------------------------------------------- [ljError IOType Channel4 ljValue4(i)] = ljud_GetFirstResult(ljHandle,0,0,0,0,0); [ljError IOType Channel5 ljValue5(i)] = ljud_GetNextResult(ljHandle,0,0,0,0,0); % Get sensor data FP mark(i)=get(handles.givemark,'value');%read mark if mark(i)>0;% mark the data with button from user interface set(handles.givemark,'value',0);% reset markbutton end %% Update arrow % use callbration to plot arrow Fz=9.4196*ljValue4(i)^2-14.32*ljValue4(i)+3.104-0.5; if Fz < 0.2; Fz=0; end Ft=-62.065*ljValue5(i)^2+190.88*ljValue5(i)-133.25; if Ft < 0.2; Ft=0; end % scaling factor for displayed error casepopup=[2 2.5 3.5 1.5 2.5 10 4.5 13];%[small-intest big-intest uterus tuba peritoneum aorta venac Fasi]=dt matrice to load F box in GUI forcetreshold=casepopup(get(handles.popupmenuforce,'value'));% this valeu comes from GUI=user interface arrow3D([0,0,0],[0,-Fz,0],forcetreshold,handles,tic,counter); % pause is essential.. to prevent excessive processor use pause (0.04); hold off end end my_vector=[ljValue4' ljValue5' t' mark']; save (['HookinF_' num2str(filenums) '.txt'],'my_vector','-ascii','-tabs'); end clear all end