⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 daqpropedit - what can do one comma.txt

📁 有一个小的错误数据采集财产编辑线225 : data.ObjectList ( CT表现1 :电脑断层+ numChildren
💻 TXT
📖 第 1 页 / 共 3 页
字号:
  if data.ExpandAll | data.IsExpanded(data.Mapping(loc)),
    loc=loc+1;
  else
    valLevel=data.Level(data.Mapping(loc));
    findLevel=find(data.Level(data.Mapping((loc+1):end))<=valLevel);
    if ~isempty(findLevel),
      loc=loc+findLevel(1);
    else
      loc=numObj+1;
    end % if ~isempty
  end % if ~
end % while
data.Mapping=data.Mapping(val);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function nameString=LGetNameString(objList)
%LGETNAMESTRING Return valid name for DAQ object
% NAMESTRING=LGETNAMESTRING(OBJLIST) returns a cell array of 
% valid name strings for the given object list.  
% The assumptions are as follows:
%   OBJLIST contains only channels/lines or devices. 
%   Channels/Lines and Devices are never mixed
%   If it's a device, objList is only 1 element long
%   If it's a set of channels/lines there can be between 0 and n objects

% It's a device
if ~all(ischannel(objList)|isdioline(objList)),
  name=get(objList,'Name');
  tag=get(objList,'Tag');
  nameString={[name '  (' tag ')']};
  
else
  numObj=length(objList);
  if ischannel(objList(1)),
    name=get(objList,{'ChannelName'});
    typeStr='Channel ';
  else
    name=get(objList,{'LineName'});
    typeStr='Line ';
  end
  nameString=strcat({'Channel '}, int2str((1:numObj)') , ...
      {': '},name);
end % if
  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% LGetValueString %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [valString,typeFlag]=LGetValueString(data,val)
% Called by LSubPropertyChange.  For all values other than enums
% this returns a 1 line string representation.  typeFlag says
% whether the value for the string could be contained on 1 line
% or not.
listStr=get(data.hUI(1),'String');
loc=get(data.hUI(1),'Value');
str=listStr(loc,:);
valString=fliplr(deblank(fliplr(deblank(str))));
valString(1:length(data.CurrentProp)+2)='';

typeFlag=1;

switch class(val),
  case 'double',  
    if isempty(val),
      valString=['[ ]'];
      typeFlag=0;
    else     
      if length(size(val))<=2 && size(val,1)==1,
        valString=mat2str(val);
        typeFlag=0;
      end
    end % if isempty      

  case 'char',
   if (length(size(val))<=2 && size(val,1)==1) || isempty(val),
     valString=valString;
     typeFlag=0;
   end

  % It's a weird value so disable it for now
  otherwise,
     
end % switch
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% LGetWorkspaceVariableName %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function data=LGetWorkspaceVariableName(data)
      
vars=evalin('base','whos');
vars={vars.name}';

goodFlag=0;
ct=1;
while ~goodFlag,
    pStr=['InWorkspace' int2str(ct)];
    if ~any(strcmp(vars,pStr)),
        goodFlag=1;
    end
    ct=ct+1;
end	
data.WorkspaceVariableName=pStr;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%
%%%%% LHelp %%%%%
%%%%%%%%%%%%%%%%%
function LHelp(hFig)
set(hFig,'Pointer','watch');

HelpCell={ ...
  'The Property Editor is used to Edit and View properties of '
  'data acquisition objects that are currently instantiated. '
  'This editor displays the currently selected object(s) in the'
  'upper listbox.  Underneath this is the property field'
  'and the value field.  Beneath these fields is the property'
  'list with all of the associated values.'
  };
helpwin(HelpCell,'DAQPROPEDIT Help');


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%
%%%%% LHelpDAQ %%%%%
%%%%%%%%%%%%%%%%%%%%
function LHelpDAQ
  doc('daq')
  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% LObjButtonDown %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
function data=LObjButtonDown(data,hFig)
%Return back and do nothing if there are no objects
if isempty(data.Mapping),
  data=LUpdate(data,[],1);
  if isempty(data.Mapping),
    return
  end
end
 
listString=get(data.hList,'String');
value=data.Mapping(get(data.hList,'Value'));
newObj=data.ObjectList{value};

switch get(hFig,'SelectionType'),
  case 'open',
    if data.IsExpanded(value), % it's expanded or childless
      %it's got children,collapse it
      if data.HasChildren(value),
        data=LCollapseTree(data,value);
      end
    else % it's collapsed and has children
      data=LExpandTree(data,value);

    end % if

  otherwise, % Normal Selection
      data=LUpdate(data,newObj);

end % switch

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% LPropertyChange %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
function data=LPropertyChange(data,callingFromUpdate)
% Called from property selection change in listbox
% Set the property edit field
% Set the value field
  
% This function is also called by LUpdate which assumes that the value has
% already been set correctly.  If the value were to be set here then things
% get out of sync
if nargin==1,
  data=LSetValue(data);
end
data.ValidProp=1;
set(data.hUI(2),'ForegroundColor',[0 0 0])
data=LSubPropertyChange(data);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%
%%%%% LQuotify %%%%%
%%%%%%%%%%%%%%%%%%%%
function Value=LQuotify(MatValue)
% Everything coming in here is a string array of 1 row

if ~isempty(MatValue),
  len=numel(MatValue);
  MatValue=MatValue([sort([1:len find(MatValue=='''')])]);
  MatValue=num2cell(MatValue,2);
  Quotes(1:size(MatValue,1),1)={''''};  
  Value=strcat(Quotes,MatValue,Quotes);  
else
  Value={''''''};    
end  
Value=char(Value);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% LQuotingNoOverlap %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function t = LQuotingNoOverlap(s,q,s3)
% This function does a strrep that checks for overlapping strings
% i.e. aaaaaa with normal strrep('aaaaaa','aa','b') returns 'bbbbb'
% This function returns 'bbb'

k = findstr(s,q);
dk = diff(k);
while any(dk<length(q));
  p = min(find(dk<length(q)));
  k(p+1) = [];
  dk = diff(k);
end

s2len = length(q);

s2pos = k-1;
s1 = s;
% Build resulting string
s=[];
s1pos=1;
for i=1:length(s2pos),
  s=[s,s1(s1pos:s2pos(i)),s3];
  s1pos=s2pos(i)+s2len+1;
end;
t=[s,s1(s1pos:length(s1))];

if isempty(t),t='';end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%
%%%%% LResize %%%%%
%%%%%%%%%%%%%%%%%%%
function LResize(data,hFig)

Data=get(hFig,'UserData');
allHandles=[hFig ; data.hFrame ; data.hUI; data.hInfo];
set(allHandles,'Units','characters');

hOffset=1;
vOffset=.5;
btnWidth=12;
btnHeight=1.5;
txtMove=.5;

posFig=get(hFig,'Position');
if posFig(4)<8,
  posFig(4)=8;
end

hgtObj=2*(btnHeight+vOffset);

posFrame(1,:)=[0 0 posFig(3:4)];

%  'InfoHelp'
%  'InfoDeviceSpecific' ; 'InfoDeviceSpecificVal'
%  'InfoReadOnlyRunning'; 'InfoReadOnlyRunningVal'
%  'InfoReadOnly'       ; 'InfoReadOnlyVal'
%  'InfoConstraintValue'; 'InfoConstraintValueVal'
%  'InfoConstraint'     ; 'InfoConstraintVal'
%  'InfoDefaultValue'   ; 'InfoDefaultValueVal'
%  'InfoType'           ; 'InfoTypeVal'
posInfo(1,:)=[posFrame(1,1)+hOffset posFrame(1,2)+vOffset ...
              posFrame(1,3)-2*hOffset 6*btnHeight];
posInfo(2,:)=[posInfo(1,1) sum(posInfo(1,[2 4]))+vOffset ...
              posInfo(1,3)/4 btnHeight];
posInfo(3,:)=posInfo(2,:);
posInfo(3,1)=sum(posInfo(2,[1 3]));
posInfo(4:5,:)=posInfo(2:3,:);
posInfo(4,1)=posInfo(1,1)+posInfo(1,3)/2;

posInfo(4:5,2)=sum(posInfo(4,[2 4]));
posInfo(5,1)=sum(posInfo(4,[1 3]));

for lp=6:length(data.hInfo),
  posInfo(lp,:)=posInfo(lp-4,:);
  posInfo(lp,2)=sum(posInfo(lp,[2 4]));
end
posInfo(2:end,3)=.9*posInfo(2:end,3);

posInfo(4,2)=posInfo(3,2);
posInfo(4,4)=posInfo(8,2)-posInfo(4,2);

posFrame(1,4)=sum(posInfo(end,[2 4]))+vOffset-posFrame(1,2);

remainingRoom=posFig(4)-sum(posFrame(1,[2 4]));
if remainingRoom<6,remainingRoom=6;end

btmHeight=(remainingRoom-hgtObj)/2;
topHeight=remainingRoom-btmHeight;
posFrame(3,:)=[0 posFig(4)-topHeight posFrame(1,3) topHeight];
posFrame(2,:)=[0 sum(posFrame(1,[2 4])) posFrame(1,3) btmHeight];

% PropertyList
posUI(1,:)=[posFrame(2,1)+hOffset   posFrame(2,2)+vOffset ...
            posFrame(2,3)-2*hOffset posFrame(2,4)-2*vOffset];
% Property
posUI(2,:)=[posUI(1,1)   posFrame(3,2)+vOffset ...
           (diff(posFrame(3,[1 3]))-3*hOffset)/2 btnHeight];
% Value
posUI(3,:)=posUI(2,:);
posUI(3,1)=sum(posUI(2,[1 3]))+hOffset;
posUI(4,:)=posUI(3,:);
posUI(5,:)=posUI(3,:);
% Object List
posUI(6,:)=[posUI(2,1) sum(posUI(3,[2 4])) posUI(1,3) 0];
posUI(6,4)=sum(posFrame(3,[2 4]))-posUI(6,2)-vOffset;

posUI=num2cell(posUI,2);
posFrame=num2cell(posFrame,2);
posInfo=num2cell(posInfo,2);

set(data.hFrame,{'Position'},posFrame);
set(data.hUI,{'Position'},posUI);
set(data.hInfo,{'Position'},posInfo);
set(allHandles,'Units','normalized');

%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% LSetProperty %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
function data=LSetProperty(data)
% The user has typed in a new property name or part of one.
% First set the value for the previous property.  Then determine
% the new property name, set it in the field and then set the
% value field and the selection in the listbox string.

data=LSetValue(data);

oldProp=get(data.hUI(2),'String');
if ~isempty(oldProp),
  [r,c]=find(oldProp~=' ' & oldProp~=0);      
  oldProp=oldProp(:,min(c):max(c));
  % High Speed Property Editing      
  if ~isempty(oldProp),
    [r,c]=find(oldProp==' ');      
    if ~isempty(c),      
      oldProp=oldProp(:,1:max(c)-1);
    end      
  end      
  
else
  oldProp=data.PropList{1};      
end   

property=lower(oldProp);
propList = lower(data.PropList);

value=strmatch(property,propList);
color=[0 0 0];

switch length(value),
  case 0,    
    color=[1 0 0];
    value=[];      
    data.ValidProp=0;        
    
  case 1,
    property=data.PropList{value};      
    data.ValidProp=1;        
    
  otherwise,
    newValue=strmatch(property,propList(value),'exact');
    if ~isempty(newValue), % The typed property is an exact match
      value=value(newValue);
      property=data.PropList{value};      
      data.ValidProp=1;
    else
      color=[1 0 0];
      data.ValidProp=0;             
      subPropList=char(data.PropList(value));
      matchPoint=sum(subPropList,1)==length(value)*subPropList(1,:);
      noMatchLoc=find(~matchPoint);
      if isempty(noMatchLoc),
    property='';
      else           
    matchLen=min(noMatchLoc)-1;          
    property=subPropList(1,1:matchLen);            
      end            
      
    end % if ~isempty
end % switch        

if data.ValidProp,
  data.CurrentProp=property;
end

if isempty(value),
  value=1;
end % if

set(data.hUI(1),'Value',value);
set(data.hUI(2),'ForegroundColor',color,'String',property);

data=LSubPropertyChange(data);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%
%%%%% LSetValue %%%%%
%%%%%%%%%%%%%%%%%%%%%
function data=LSetValue(data)
% Set the Value
data.ValidValue=logical(1);

if ~isempty(data.CurrentObj) && ~isempty(data.CurrentProp),
  curPropInfo=propinfo(data.CurrentObj,data.CurrentProp);
  if ~curPropInfo.ReadOnly,
    % Check to see if the popupmenu is visible
    if strcmp(get(data.hUI(4),'Visible'),'on'),
      valStr=get(data.hUI(4),{'String','Value'});
      val=valStr{1}{valStr{2}};
      
      % It's not read-only and it's not enumerated
    else
      if data.ToWorkspace,
	% Check to see if the same string is still typed in
	% If it isn't then take the string as a literal
	% and move on to the next section by setting data.ToWorkspace 
	% back to 0
	baseVars=evalin('base','whos');
	baseVars={baseVars.name};
	if any(strcmp(baseVars,data.WorkspaceVariableName)),
	  try
	    val=evalin('base',data.WorkspaceVariableName);
	  catch
	    val=get(data.CurrentObj,data.CurrentProp);
	  end
	else
	  data.ToWorkspace=logical(0);
	end
	evalin('base',['clear ' data.WorkspaceVariableName ],'');
      end
      
      
      if ~data.ToWorkspace,
	str=get(data.hUI(3),'String');
	switch curPropInfo.Type,
	 case {'string','callback function'},
	  val=LDeQuotify(str);
	 otherwise,
	  try
	    if ~isempty(str),
	      val=eval(str);
	    else
	      val=[];
	    end
	  catch
	    % do nothing for now it will be caught below
	    val=[];
	  end
	end
	
      end % if ~data.ToWorkspace
    end % if strcmp popup vis on
    
    % Set the value
    try
      % Take care of setting the channel property to an empty value
      if ~(isequal(data.CurrentProp,'Channel') && isempty(val)),
        set(data.CurrentObj,data.CurrentProp,val)
      end
    catch
      data.ValidValue=logical(0);
    end
    
    if ~data.ValidValue,
        set(data.hUI(3:5),'ForegroundColor',[1 0 0]);
    else

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -