Ac9cal.m
Jump to navigation
Jump to search
% Title: AC9CAL.M
% Date:
% Author: srw
% Input: ['par_name','par_value', etc]
% Output:
% Files: ac9cal_cb.m,ac9cal_gui.mat
% Assumes:
% Purpose: View and process ac9 calibration data
% Calls: ac9cal_cb,
% Uses:
% Example: ac9cal or ac9cal('list_file','foo.txt')
% NOTES: comments and caveats
%
% ac9cal returns the figure number of the ac9cal gui and the
% structure stored in the ac9calFig userdata,
% ac9.par field initially contains acrcal_def.par values and is then
% updated according to arguments passed to this function.
% ac9.other fields are for each object in ac9calFig and contain a value
% and a string field.
% Creates/raises ac9cal figure, initializes/gets ac9 structure.
% Assigns parameters passed through function call to ac9.par fields,
% no need for define/default values here as there are taken care of
% in ac9cal_cb('init').
% Updates userdata in ac9calFig.
% Raises QcaledFig1, if open, gets filename and properties from QcaledFig1.
% Good for finding ac9cal window from matlab prompt.
% Updates ac9calFig objects and userdata in ac9calFig.
%
% NOTE: Values in the userdata structure do reflect changes on the
% gui until an ac9cal_cb('par_update') is given.
function [ac9calfig,ac9]=ac9cal(varargin)
if nargin==1 & strcmp(varargin{1},'quit'),
file_gui_cb('CloseAll');
return
end
%Create/raise ac9cal figure
ac9calfig=findall(0,'Tag','ac9calFig');
if isempty(ac9calfig),
ac9.par=ac9cal_cb('init');
ac9calfig=ac9cal_cb('ac9cal_gui','par',ac9.par);
else
figure(ac9calfig);
ac9=get(ac9calfig,'User');
end
ac9cal_cb('reset');
%Update ac9.par fields with pairs passed to this function
narg=length(varargin);
nrow=narg/2;
if nrow==round(nrow),
for iarg=1:2:length(varargin),
eval(['ac9.par.' varargin{iarg} '= varargin{iarg+1}']);
end
else
display('ac9cal_cb: command line pairs not correctly formed');
return
end
%Store in ac9calfig userdata
set(ac9calfig,'User',ac9);
%
filename=ac9.par.list_file;
%assign list_file in QcaledFig, the list_file editor, if there
fig=findobj('Tag','QcaledFig1');
if ~isempty(fig),
get(findobj(fig,'Tag','list_file'),'String');
if ~isempty(ans),
filename=ans;
end
str=strvcat('prop','abs','fluid','air');
%Update ac9calfig objects with values from QcaledFig1
for ip=1:4,
get(findobj(fig,'Tag',deblank(str(ip,:))),'Value');
set(findobj(ac9calfig,'Tag',deblank(str(ip,:))),'Value',ans);
end
end
set(findobj(ac9calfig,'Tag','list_file'),'String',filename);
%Poll and parse all objects for sting and value, put into ac9
ac9=ac9cal_cb('par_update');
%Store in ac9calfig userdata
set(ac9calfig,'User',ac9);
return