[Dart-dev] [6145] DART/branches/development/matlab/get_copy_index.m: Slicker way to remove whitespace from strings.

nancy at ucar.edu nancy at ucar.edu
Thu May 16 19:26:00 MDT 2013


Revision: 6145
Author:   thoar
Date:     2013-05-16 19:25:59 -0600 (Thu, 16 May 2013)
Log Message:
-----------
Slicker way to remove whitespace from strings.
m-lint purports this to be faster.

Modified Paths:
--------------
    DART/branches/development/matlab/get_copy_index.m

-------------- next part --------------
Modified: DART/branches/development/matlab/get_copy_index.m
===================================================================
--- DART/branches/development/matlab/get_copy_index.m	2013-05-16 22:51:48 UTC (rev 6144)
+++ DART/branches/development/matlab/get_copy_index.m	2013-05-17 01:25:59 UTC (rev 6145)
@@ -55,7 +55,8 @@
    end
 end
 
+
 function str2 = dewhite(str1)
-% internal function to remove whitespace from a character string
-i = find( ~isspace(str1) );
-str2 = str1(i);
+%  function to remove ALL whitespace from a character string
+
+str2 = str1(~isspace(str1));


More information about the Dart-dev mailing list