-------------------> Session (re)starting: 19-Mar-2008 09:34:36 type r1 %--------------------------------------------------- % Simple example script showing a use for the Matlab % function eval(). %--------------------------------------------------- funs = char('ceil', 'floor', 'fix', 'round'); x = 3.418; numfuns = size(funs, 1); for k = 1:numfuns current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); str = [current_fun '(x)']; eval(str) end echo on r1 funs = char('ceil', 'floor', 'fix', 'round'); x = 3.418; numfuns = size(funs, 1); for k = 1:numfuns current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating ceil str = [current_fun '(x)']; eval(str) ans = 4 current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating floor str = [current_fun '(x)']; eval(str) ans = 3 current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating fix str = [current_fun '(x)']; eval(str) ans = 3 current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating round str = [current_fun '(x)']; eval(str) ans = 3 ccc warning('off', 'all'); clear all; clear global; clear functions; clear java; clear classes; warning('on', 'all'); hold off; close all; clc; r1 funs = char('ceil', 'floor', 'fix', 'round'); x = 3.418; numfuns = size(funs, 1); for k = 1:numfuns current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating ceil str = [current_fun '(x)']; eval(str) ans = 4 current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating floor str = [current_fun '(x)']; eval(str) ans = 3 current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating fix str = [current_fun '(x)']; eval(str) ans = 3 current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating round str = [current_fun '(x)']; eval(str) ans = 3 whos Name Size Bytes Class Attributes ans 1x1 8 double current_fun 1x5 10 char funs 4x5 40 char k 1x1 8 double numfuns 1x1 8 double str 1x8 16 char x 1x1 8 double ccc warning('off', 'all'); clear all; clear global; clear functions; clear java; clear classes; warning('on', 'all'); hold off; close all; clc; type r2 %--------------------------------------------------- % Simple example script showing a use for the Matlab % function eval(). %--------------------------------------------------- funs = char('ceil', 'floor', 'fix', 'round'); x = 3.418; k = 3; f = deblank(funs(k,:)); current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); str = [current_fun '(x)']; funresult = eval(str); disp(['Type of variable funresult is ' class(funresult)]); f = deblank(funs(k,:)); disp(['Evaluating ' current_fun ' using evalc instead']); str = [current_fun '(x)']; fc = evalc(str); disp(['Type of variable fc is ' class(fc)]); r2 funs = char('ceil', 'floor', 'fix', 'round'); x = 3.418; k = 3; f = deblank(funs(k,:)); current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating fix str = [current_fun '(x)']; funresult = eval(str); disp(['Type of variable funresult is ' class(funresult)]); Type of variable funresult is double f = deblank(funs(k,:)); disp(['Evaluating ' current_fun ' using evalc instead']); Evaluating fix using evalc instead str = [current_fun '(x)']; fc = evalc(str); disp(['Type of variable fc is ' class(fc)]); Type of variable fc is char fc fc = ans = 3 funresult funresult = 3 ccc warning('off', 'all'); clear all; clear global; clear functions; clear java; clear classes; warning('on', 'all'); hold off; close all; clc; lookfor type COMPUTER Computer type. FINFO Identify file type against standard file handlers on path TYPE List M-file. CHANGESERIESTYPE Change a series plot type parseSoapResponse Convert the response from a SOAP server into MATLAB types. WK1CONST WK1 record type definitions. CAST Cast a variable to a different data type or class. TYPECAST Convert datatypes without changing underlying data. ISINTEGER True for arrays of integer data type. DBTYPE List M-file with line numbers. HDSNEWARRAY Creates new array of specified size and type. createtdtlisteners.m: % Create DeviceType listeners NUMERICTYPEDDG Dynamic dialog for Simulink numeric type objects. ALIASTYPEDDG Dynamic dialog for Simulink alias type objects. ANNOTATIONDDG Dynamic dialog for Simulink Annotation type objects. rtwmath_data_type_prop_list.m: %DATA_TYPE_PROP_LIST - List of all data types that can reference STRUCTTYPEDDG Dynamic dialog for Simulink StructType objects. BUSDDG Dynamic dialog for Simulink Bus type objects. BUSELEMENTDDG Dynamic dialog for Simulink BusElement type objects. SHOWBLOCKDATATYPETABLE Launches html page in help browser to show sigSpecDataTypeParamCallBackFcn : Callback function for the data type GETDATATYPESPECS is for internal use only by Simulink SFRAC Create structure describing Signed FRACtional data type UINT Create structure describing Unsigned INTeger data type UFIX Create structure describing Unsigned FIXed point data type SINT Create structure describing Signed INTeger data type UFRAC Create structure describing Unsigned FRACtional data type FIXDT Create an object describing a fixed-point or floating-point data type SFIX Create structure describing Signed FIXed point data type FLOAT Create structure describing a floating point data type fixpt_data_type_rules This is function for private use by Simulink sldemo_tc_script.m: %% Approximating Nonlinear Relationships: Type S Thermocouple GENRTWTYPESDOTH Based on model's active configset settings, it will NUMERICTYPEDIALOG Dynamic dialog for numerictype object. ISNUMERICTYPE True for NUMERICTYPE object NUMERICTYPE Object which encapsulates numeric type information LTIPLOTTYPES Return information about built-in LTI plot types. GSModelTypeConversions_aux.m: % Helper function for GSModelTypeConversions GSModelTypeConversions.m: %% Model Type Conversions NDDModelTypeConversions.m: %% Model Type Conversions eml_getnumerictypeprop_helper.m: % EML helper function that returns the property value of the numerictype T emlGetBestPrecForMxArray Get best-precision numerictype for builtin array input emlGetNTypeForSum Get numerictype for SUM emlGetNTypeForTimes Get numerictype for TIMES emlGetNTypeForMTimes Get numerictype for matrix times (MTIMES) emlGetNTypeForPlus Get numerictype for plus EML_NUMERICTYPE_CONSTRUCTOR_HELPER Helper function for eML to construct a TYPE_NOCOMMENTS List file with no comments FI_BEST_NUMERIC_TYPE_FROM_LOGS Best fixed-point numeric type from min/max logs. FI_DATATYPE_OVERRIDE_DEMO_PLOT Plot function for fi doubles override demo. TYPE_NOCOMMENTS_NOSUBFUNCTIONS List file with no comments fi_datatype_override_demo.m: %% Fixed-Point Data Type Override, Min/Max Logging, and Scaling GENFIS2 Generates a Sugeno-type FIS using subtractive clustering. ANFIS Adaptive Neuro-Fuzzy training of Sugeno-type FIS. GENFIS1 Generates an initial Sugeno-type FIS for ANFIS training using a grid ccc warning('off', 'all'); clear all; clear global; clear functions; clear java; clear classes; warning('on', 'all'); hold off; close all; clc; type r3.m % Useful string functions cellstr(str) : create a cell array of strings from str blanks(n) : create a string of n blanks deblank(str) : remove trailing blanks from str strtrim(str) : remove both leading and trailing blanks strjust(str,type) : justify the text in str to left, center, right depending on value of type. e.g., type = 'right' findstr(str1, str2) : find indices of a shorter string in a longer one. : return type is numeric (a double or array of doubles) strfind(str1, str2) : find indices of a shorter string str1 in str2. : return type is numeric (a double or array of doubles) strcmp(str1, str2) : true if str1 is equal to str2 strncmp(str1, str2, n) : true if first n characters in str1 and str2 are equal strcmpi(str1, str2) : true if str1 is equal to str2, ignoring case strmatch(str1, str2) : returns indices for which str1 appears in str2 strmatch(str1, str2, 'exact')) : returns exact matches only sscanf(str) : read the string under format control. deal(C) r1 funs = char('ceil', 'floor', 'fix', 'round'); x = 3.418; numfuns = size(funs, 1); for k = 1:numfuns current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating ceil str = [current_fun '(x)']; eval(str) ans = 4 current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating floor str = [current_fun '(x)']; eval(str) ans = 3 current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating fix str = [current_fun '(x)']; eval(str) ans = 3 current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); Evaluating round str = [current_fun '(x)']; eval(str) ans = 3 clc type r3.m % Useful string functions cellstr(str) : create a cell array of strings from str blanks(n) : create a string of n blanks deblank(str) : remove trailing blanks from str strtrim(str) : remove both leading and trailing blanks strjust(str,type) : justify the text in str to left, center, right depending on value of type. e.g., type = 'right' findstr(str1, str2) : find indices of a shorter string in a longer one. : return type is numeric (a double or array of doubles) strfind(str1, str2) : find indices of a shorter string str1 in str2. : return type is numeric (a double or array of doubles) strcmp(str1, str2) : true if str1 is equal to str2 strncmp(str1, str2, n) : true if first n characters in str1 and str2 are equal strcmpi(str1, str2) : true if str1 is equal to str2, ignoring case strmatch(str1, str2) : returns indices for which str1 appears in str2 strmatch(str1, str2, 'exact')) : returns exact matches only sscanf(str) : read the string under format control. deal(C) whos Name Size Bytes Class Attributes ans 1x1 8 double current_fun 1x5 10 char funs 4x5 40 char k 1x1 8 double numfuns 1x1 8 double str 1x8 16 char x 1x1 8 double funs funs = ceil floor fix round strfind('ce', funs) ??? Error using ==> strfind Input strings must have one row. strfind('ce', funs(2,:)) ans = [] strfind('ce', funs(1,:)) ans = [] whos Name Size Bytes Class Attributes ans 0x0 0 double current_fun 1x5 10 char funs 4x5 40 char k 1x1 8 double numfuns 1x1 8 double str 1x8 16 char x 1x1 8 double help strfind STRFIND Find one string within another. K = STRFIND(TEXT,PATTERN) returns the starting indices of any occurrences of the string PATTERN in the string TEXT. STRFIND will always return [] if PATTERN is longer than TEXT. If you wish to search for inclusion of either TEXT in PATTERN or PATTERN in TEXT, use FINDSTR instead. Examples s = 'How much wood would a woodchuck chuck?'; strfind(s,'a') returns 21 strfind('a',s) returns [] strfind(s,'wood') returns [10 23] strfind(s,'Wood') returns [] strfind(s,' ') returns [4 9 14 20 22 32] See also findstr, strcmp, strncmp, strmatch, regexp. Overloaded functions or methods (ones with the same name in other directories) help cell/strfind.m Reference page in Help browser doc strfind findstr('ce', funs(1,:)) ans = 1 type r3 % Useful string functions cellstr(str) : create a cell array of strings from str blanks(n) : create a string of n blanks deblank(str) : remove trailing blanks from str strtrim(str) : remove both leading and trailing blanks strjust(str,type) : justify the text in str to left, center, right depending on value of type. e.g., type = 'right' findstr(str1, str2) : find indices of a shorter string in a longer one. : return type is numeric (a double or array of doubles) strfind(str1, str2) : find indices of a shorter string str1 in str2. : return type is numeric (a double or array of doubles) strcmp(str1, str2) : true if str1 is equal to str2 strncmp(str1, str2, n) : true if first n characters in str1 and str2 are equal strcmpi(str1, str2) : true if str1 is equal to str2, ignoring case strmatch(str1, str2) : returns indices for which str1 appears in str2 strmatch(str1, str2, 'exact')) : returns exact matches only sscanf(str) : read the string under format control. deal(C) help deal DEAL Deal inputs to outputs. [A,B,C,...] = DEAL(X,Y,Z,...) simply matches up the input and output lists. It is the same as A=X, B=Y, C=Z, ... [A,B,C,...] = DEAL(X) copies the single input to all the requested outputs. It is the same as A=X, B=X, C=X, ... DEAL is most useful when used with cell arrays and structures via comma separated list expansion. Here are some useful constructions: [S.FIELD] = DEAL(X) sets all the fields with the name FIELD in the structure array S to the value X. If S doesn't exist, use [S(1:M).FIELD] = DEAL(X); [X{:}] = DEAL(A.FIELD) copies the values of the field with name FIELD to the cell array X. If X doesn't exist, use [X{1:M}] = DEAL(A.FIELD). [A,B,C,...] = DEAL(X{:}) copies the contents of the cell array X to the separate variables A,B,C,... [A,B,C,...] = DEAL(S.FIELD) copies the contents of the fields with the name FIELD to separate variables A,B,C,... Examples: sys = {rand(3) ones(3,1) eye(3) zeros(3,1)}; [a,b,c,d] = deal(sys{:}); direc = dir; filenames = {}; [filenames{1:length(direc),1}] = deal(direc.name); See also lists, paren. Reference page in Help browser doc deal help lists LISTS Comma separated lists. Extracting multiple values from a cell array or structure results in a list of values (as if separated by commas). The comma-separated lists are valid: 1) by themselves on the command line to display the values, C{:} or S.name 2) within parentheses as part of a function call, myfun(x,y,C{:}) or myfun(x,y,S.name) 3) within square brackets as part of a horizontal concatenation [C{:}] or [S.name] 4) within square brackets as part of a function output list, [C{:}] = myfun or [S.name] = myfun 5) within braces as part of a cell array construction. {C{:}} or {S.name} In all these uses, C{:} is the same as C{1},C{2},...,C{end} and S.name is the same as S(1).name,S(2).name,...,S(end).name. If C or S is 1-by-1 then these expressions produce the familiar single element extraction. Any indexing expression that attempts to extract more than one element produces a comma separated list. Hence C{1:5} and S(2:3).name are also comma separated lists. Comma separated list are very useful when dealing with variable input or output argument lists or for converting the contents of cell arrays and structures into matrices. Examples C = {1 2 3 4}; A = [C{:}]; B = cat(2,C{:}); [S(1:3).FIELD] = deal(5); See also varargin, varargout, deal, cell2struct, struct2cell, num2cell, cat, paren. ccc warning('off', 'all'); clear all; clear global; clear functions; clear java; clear classes; warning('on', 'all'); hold off; close all; clc; type r4 % Difference between match and exact match echo on; funs = char('ceil', 'floor', 'fix', 'round', 'ceiling' 'celestial'); str1 = 'ceil'; disp('using strmatch: ') strmatch(str1, funs) disp('using strmatch with exact: ') strmatch(str1, funs, 'exact') disp('next, using strncmpi: ') k = 2; strncmpi(str1, funs, k) pause; current_fun = deblank(funs(1,:)); strncmpi(str1, current_fun, k) echo off; r4 ??? Error: File: r4.m Line: 5 Column: 56 Unexpected MATLAB expression. bg ??? Undefined function or variable 'bg'. type r4 % Difference between match and exact match echo on; funs = char('ceil', 'floor', 'fix', 'round', 'ceiling', 'celestial'); str1 = 'ceil'; disp('using strmatch: ') strmatch(str1, funs) disp('using strmatch with exact: ') strmatch(str1, funs, 'exact') disp('next, using strncmpi: ') k = 2; strncmpi(str1, funs, k) pause; current_fun = deblank(funs(1,:)); strncmpi(str1, current_fun, k) echo off; r4 echo on; funs = char('ceil', 'floor', 'fix', 'round', 'ceiling', 'celestial'); str1 = 'ceil'; disp('using strmatch: ') using strmatch: strmatch(str1, funs) ans = 1 5 disp('using strmatch with exact: ') using strmatch with exact: strmatch(str1, funs, 'exact') ans = 1 disp('next, using strncmpi: ') next, using strncmpi: k = 2; strncmpi(str1, funs, k) ans = 0 pause; current_fun = deblank(funs(1,:)); strncmpi(str1, current_fun, k) ans = 1 echo off; ccc type r5 ??? Error using ==> type File 'r5' not found. type r4 % Difference between match and exact match echo on; funs = char('ceil', 'floor', 'fix', 'round', 'ceiling', 'celestial'); str1 = 'ceil'; disp('using strmatch: ') strmatch(str1, funs) disp('using strmatch with exact: ') strmatch(str1, funs, 'exact') disp('next, using strncmpi: ') k = 2; strncmpi(str1, funs, k) pause; current_fun = deblank(funs(1,:)); strncmpi(str1, current_fun, k) echo off; help strncmpi STRNCMPI Compare first N characters of strings ignoring case. TF = STRNCMPI(S1,S2) compares the first N characters of strings S1 and S2 and returns logical 1 (true) if they are the same except for case, and returns logical 0 (false) otherwise. TF = STRNCMPI(S,C), compares the first N characters of string S to each element of cell array C, where S is a character vector (or a 1-by-1 cell array) and C is a cell array of strings. The function returns TF, a logical array that is the same size as C and contains logical 1 (true) for those elements of C that are a match, except for case, and logical 0 (false) for those elements that are not. The order of the two input arguments is not important. TF = STRNCMPI(C1,C2) compares the first N characters of each element of C1 to the same element in C2, where C1 and C2 are equal-size cell arrays of strings. Input C1 and/or C2 can also be a character array having the number of rows as there are cells in the cell array. The function returns TF, a logical array that is the same size as C1 or C2, and contains logical 1 (true) for those elements of C1 and C2 that are a match, except for case, and logical 0 (false) for those elements that are not. When one of the inputs is a cell array, scalar expansion will occur as needed. STRNCMPI supports international character sets. See also strcmp, strncmp, strcmpi, findstr, strmatch, regexpi. Overloaded functions or methods (ones with the same name in other directories) help opaque/strncmpi.m Reference page in Help browser doc strncmpi help regexp REGEXP Match regular expression. S = REGEXP(STRING,EXPRESSION) matches the regular expression, EXPRESSION, in the string, STRING. The indices of the beginning of the matches are returned. In EXPRESSION, patterns are specified using combinations of metacharacters and literal characters. There are a few classes of metacharacters, partially listed below. More extensive explanation can be found in the Regular Expressions section of the MATLAB documentation. The following metacharacters match exactly one character from its respective set of characters: Metacharacter Meaning --------------- -------------------------------- . Any character [] Any character contained within the brackets [^] Any character not contained within the brackets \w A word character [a-z_A-Z0-9] \W Not a word character [^a-z_A-Z0-9] \d A digit [0-9] \D Not a digit [^0-9] \s Whitespace [ \t\r\n\f\v] \S Not whitespace [^ \t\r\n\f\v] The following metacharacters are used to logically group subexpressions or to specify context for a position in the match. These metacharacters do not match any characters in the string: Metacharacter Meaning --------------- -------------------------------- () Group subexpression | Match subexpression before or after the | ^ Match expression at the start of string $ Match expression at the end of string \< Match expression at the start of a word \> Match expression at the end of a word The following metacharacters specify the number of times the previous metacharacter or grouped subexpression may be matched: Metacharacter Meaning --------------- -------------------------------- * Match zero or more occurrences + Match one or more occurrences ? Match zero or one occurrence {n,m} Match between n and m occurrences Characters that are not special metacharacters are all treated literally in a match. To match a character that is a special metacharacter, escape that character with a '\'. For example '.' matches any character, so to match a '.' specifically, use '\.' in your pattern. Example: str = 'bat cat can car coat court cut ct caoueouat'; pat = 'c[aeiou]+t'; regexp(str, pat) returns [5 17 28 35] When one of STRING or EXPRESSION is a cell array of strings, REGEXP matches the string input with each element of the cell array input. Example: str = {'Madrid, Spain' 'Romeo and Juliet' 'MATLAB is great'}; pat = '\s'; regexp(str, pat) returns {[8]; [6 10]; [7 10]} When both STRING and EXPRESSION are cell arrays of strings, REGEXP matches the elements of STRING and EXPRESSION sequentially. The number of elements in STRING and EXPRESSION must be identical. Example: str = {'Madrid, Spain' 'Romeo and Juliet' 'MATLAB is great'}; pat = {'\s', '\w+', '[A-Z]'}; regexp(str, pat) returns {[8]; [1 7 11]; [1 2 3 4 5 6]} REGEXP supports up to six outputs. These outputs may be requested individually or in combinations by using additional input keywords. The order of the input keywords corresponds to the order of the results. The input keywords and their corresponding results in the default order are: Keyword Result --------------- -------------------------------- 'start' Row vector of starting indices of each match 'end' Row vector of ending indices of each match 'tokenExtents' Cell array of extents of tokens in each match 'match' Cell array of the text of each match 'tokens' Cell array of the text of each token in each match 'names' Structure array of each named token in each match Example: str = 'regexp helps you relax'; pat = '\w*x\w*'; m = regexp(str, pat, 'match') returns m = {'regexp', 'relax'} Tokens are created by parenthesized subexpressions within EXPRESSION. Example: str = 'six sides of a hexagon'; pat = 's(\w*)s'; t = regexp(str, pat, 'tokens') returns t = {{'ide'}} Named tokens are denoted by the pattern (?...). The 'names' result structure will have fields corresponding to the named tokens in EXPRESSION. Example: str = 'John Davis; Rogers, James'; pat = '(?\w+)\s+(?\w+)|(?\w+),\s+(?\w+)'; n = regexp(str, pat, 'names') returns n(1).first = 'John' n(1).last = 'Davis' n(2).first = 'James' n(2).last = 'Rogers' By default, REGEXP returns all matches. To find just the first match, use REGEXP(STRING,EXPRESSION,'once'). REGEXP supports international character sets. See also regexpi, regexprep, regexptranslate, strcmp, strfind. Reference page in Help browser doc regexp more on help regexp REGEXP Match regular expression. S = REGEXP(STRING,EXPRESSION) matches the regular expression, EXPRESSION, in the string, STRING. The indices of the beginning of the matches are returned. In EXPRESSION, patterns are specified using combinations of metacharacters and literal characters. There are a few classes of metacharacters, partially listed below. More extensive explanation can be found in the Regular Expressions section of the MATLAB documentation. The following metacharacters match exactly one character from its respective set of characters: Metacharacter Meaning --------------- -------------------------------- . Any character [] Any character contained within the brackets [^] Any character not contained within the brackets \w A word character [a-z_A-Z0-9] \W Not a word character [^a-z_A-Z0-9] \d A digit [0-9] \D Not a digit [^0-9] \s Whitespace [ \t\r\n\f\v] \S Not whitespace [^ \t\r\n\f\v] The following metacharacters are used to logically group subexpressions or to specify context for a position in the match. These metacharacters do not match any characters in the string: Metacharacter Meaning --------------- -------------------------------- () Group subexpression | Match subexpression before or after the | ^ Match expression at the start of string $ Match expression at the end of string \< Match expression at the start of a word \> Match expression at the end of a word The following metacharacters specify the number of times the previous metacharacter or grouped subexpression may be matched: Metacharacter Meaning --------------- -------------------------------- * Match zero or more occurrences + Match one or more occurrences ? Match zero or one occurrence {n,m} Match between n and m occurrences Characters that are not special metacharacters are all treated literally in a match. To match a character that is a special metacharacter, escape that character with a '\'. For example '.' matches any character, so to match a '.' specifically, use '\.' in your pattern. Example: str = 'bat cat can car coat court cut ct caoueouat'; pat = 'c[aeiou]+t'; regexp(str, pat) returns [5 17 28 35] When one of STRING or EXPRESSION is a cell array of strings, REGEXP matches the string input with each element of the cell array input. Example: str = {'Madrid, Spain' 'Romeo and Juliet' 'MATLAB is great'}; pat = '\s'; regexp(str, pat) returns {[8]; [6 10]; [7 10]} When both STRING and EXPRESSION are cell arrays of strings, REGEXP matches the elements of STRING and EXPRESSION sequentially. The number of elements in STRING and EXPRESSION must be identical. Example: str = {'Madrid, Spain' 'Romeo and Juliet' 'MATLAB is great'}; pat = {'\s', '\w+', '[A-Z]'}; regexp(str, pat) returns {[8]; [1 7 11]; [1 2 3 4 5 6]} REGEXP supports up to six outputs. These outputs may be requested individually or in combinations by using additional input keywords. The order of the input keywords corresponds to the order of the results. The input keywords and their corresponding results in the default order are: Keyword Result --------------- -------------------------------- 'start' Row vector of starting indices of each match 'end' Row vector of ending indices of each match 'tokenExtents' Cell array of extents of tokens in each match 'match' Cell array of the text of each match 'tokens' Cell array of the text of each token in each match 'names' Structure array of each named token in each match Example: str = 'regexp helps you relax'; pat = '\w*x\w*'; m = regexp(str, pat, 'match') returns m = {'regexp', 'relax'} Tokens are created by parenthesized subexpressions within EXPRESSION. Example: str = 'six sides of a hexagon'; pat = 's(\w*)s'; t = regexp(str, pat, 'tokens') returns t = {{'ide'}} Named tokens are denoted by the pattern (?...). The 'names' result structure will have fields corresponding to the named tokens in EXPRESSION. Example: str = 'John Davis; Rogers, James'; pat = '(?\w+)\s+(?\w+)|(?\w+),\s+(?\w+)'; n = regexp(str, pat, 'names') returns n(1).first = 'John' n(1).last = 'Davis' n(2).first = 'James' n(2).last = 'Rogers' By default, REGEXP returns all matches. To find just the first match, use REGEXP(STRING,EXPRESSION,'once'). REGEXP supports international character sets. See also regexpi, regexprep, regexptranslate, strcmp, strfind. Reference page in Help browser doc regexp whos r1 Evaluating ceil ans = 4 Evaluating floor ans = 3 Evaluating fix ans = 3 Evaluating round ans = 3 clc whos Name Size Bytes Class Attributes ans 1x1 8 double current_fun 1x5 10 char funs 4x5 40 char k 1x1 8 double numfuns 1x1 8 double str 1x8 16 char x 1x1 8 double class(ans) ans = double class(current_fun) ans = char class(funs) ans = char help bytes bytes.m not found. Use the Help browser Search tab to search the documentation, or type "help help" for help command options, such as help for methods. help attributes attributes.m not found. Use the Help browser Search tab to search the documentation, or type "help help" for help command options, such as help for methods. help excel excel.m not found. Use the Help browser Search tab to search the documentation, or type "help help" for help command options, such as help for methods. lookfor exel exel not found. lookfor excel XLSFINFO Determine if file contains Microsoft Excel spreadsheet. XLSWRITE Stores numeric array or cell array in Excel workbook. XLSREAD Get data and text from a spreadsheet in an Excel workbook. help xlswrite XLSWRITE Stores numeric array or cell array in Excel workbook. [SUCCESS,MESSAGE]=XLSWRITE(FILE,ARRAY,SHEET,RANGE) writes ARRAY to the Excel workbook, FILE, into the area, RANGE in the worksheet specified in SHEET. FILE and ARRAY must be specified. If either FILE or ARRAY is empty, a error is thrown and XLSWRITE terminates. The first worksheet of the workbook is the default. If SHEET does not exist, a new sheet is added at the end of the worksheet collection. If SHEET is an index larger than the number of worksheets, new sheets are appended until the number of worksheets in the workbook equals SHEET. The size defined by the RANGE should fit the size of ARRAY or contain only the first cell, e.g. 'A2'. If RANGE is larger than the size of ARRAY, Excel will fill the remainder of the region with #N/A. If RANGE is smaller than the size of ARRAY, only the sub-array that fits into RANGE will be written to FILE. The success of the operation is returned in SUCCESS and any accompanying message, in MESSAGE. On error, MESSAGE shall be a struct, containing the error message and message ID. See NOTE 1. [SUCCESS,MESSAGE]=XLSWRITE(FILE,ARRAY,SHEET) writes ARRAY to the Excel workbook, FILE, starting at cell A1 of SHEET. This form is used if the third argument is not a valid range. [SUCCESS,MESSAGE]=XLSWRITE(FILE,ARRAY,RANGE) writes ARRAY to the Excel workbook, FILE, using RANGE as above in the first worksheet. [SUCCESS,MESSAGE]=XLSWRITE(FILE,ARRAY) writes ARRAY to the Excel workbook, FILE, starting at cell A1 of the first worksheet. The return values are as for the above example. XLSWRITE ARRAY FILE, is the command line version of the above example. INPUT PARAMETERS: file: string defining the workbook file to write to. Default directory is pwd; default extension 'xls'. array: m x n numeric array or cell array. sheet: string defining worksheet name; double, defining worksheet index. range: string defining data region in worksheet, using the Excel 'A1' notation. RETURN PARAMETERS: SUCCESS: logical scalar. MESSAGE: struct containing message field and message_id field. EXAMPLES: SUCCESS = XLSWRITE('c:\matlab\work\myworkbook.xls',A,'A2:C4') will write A to the workbook file, myworkbook.xls, and attempt to fit the elements of A into the rectangular worksheet region, A2:C4. On success, SUCCESS will contain true, while on failure, SUCCESS will contain false. NOTE 1: The above functionality depends upon Excel as a COM server. In absence of Excel, ARRAY shall be written as a text file in CSV format. In this mode, the SHEET and RANGE arguments shall be ignored. See also xlsread, wk1write, csvwrite. Reference page in Help browser doc xlswrite help csvwrite CSVWRITE Write a comma separated value file. CSVWRITE(FILENAME,M) writes matrix M into FILENAME as comma separated values. CSVWRITE(FILENAME,M,R,C) writes matrix M starting at offset row R, and column C in the file. R and C are zero-based, that is R=C=0 specifies first number in the file. See also csvread, dlmread, dlmwrite, wk1read, wk1write. Reference page in Help browser doc csvwrite exit