NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/basics/blank.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 function outstr=blank(instr)
2 % BLANK strips leading and trailing whitespace and/or NULL characters
3 %       from input string instr.  The MATLAB function DEBLANK only
4 %       removes trailing blanks and NULLS.
5 %
6 % outstr=blank(instr)
7 %
8
9 [m,n]=size(instr);
10 if m>1
11    error('input string must be a vector');
12 end
13
14 % REMOVE LEADING BLANKS
15 %
16 [m,n]=size(instr);
17 count=0;
18 for i=1:n
19    if strcmp(instr(i),' ')==1
20       instr=instr(i+1:n-count);
21       count=count+1;
22    else
23       break;
24    end
25    
26 end
27
28 % REMOVE TRAILING BLANKS WITH MATLAB DEBLANK FUNCTION
29 %
30 outstr=deblank(instr);
31 %instr=outstr;
32 %[m,n]=size(instr);
33 %for i=n:-1:1
34 %   if strcmp(instr(i),' ')==1
35 %      outstr=instr(1:n-1);
36 %   else
37 %      break;
38 %   end
39 %end
40
Note: See TracBrowser for help on using the browser.