0001 function varargout = islinespec(str)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 if nargin == 0
0024 str = '';
0025 elseif nargin == 1
0026 if ~ischar(str)
0027 error('### The type of the input argument must be a ''char''.');
0028 end
0029 else
0030 error('### Unknown nuber of inputs.');
0031 end
0032
0033 line_style = {'-.', '--', '-', ':'};
0034 full_name_marker_style = {'square', 'diamond', 'pentagram' , 'hexagram'};
0035 marker_style = {'+', 'o', 'O', '*', '.', 'x', '^', ...
0036 '<', '>', 's', 'd', 'h', 'p', };
0037 full_name_color_style = {'red', 'green', 'cyan', 'yellow', ...
0038 'white', 'blue', 'magenta', 'black'};
0039 color_style = {'r', 'g', 'c', 'y', 'w', 'b', 'm', 'k'};
0040
0041 out_line_style = '';
0042 out_marker_style = '';
0043 out_color_style = '';
0044
0045 copy_str = str;
0046 found_marker_style = false;
0047 found_color_style = false;
0048
0049
0050 for ii = 1:length(line_style)
0051 idx = strfind(copy_str, line_style{ii});
0052 if ~isempty(idx)
0053 copy_str = strrep(copy_str, line_style{ii}, '');
0054 out_line_style = line_style{ii};
0055 break;
0056 end
0057 end
0058
0059
0060 for ii = 1:length(full_name_marker_style)
0061 idx = strfind(copy_str, full_name_marker_style{ii});
0062 if ~isempty(idx)
0063 copy_str = strrep(copy_str, full_name_marker_style{ii}, '');
0064 out_marker_style = full_name_marker_style{ii};
0065 found_marker_style = true;
0066 break;
0067 end
0068 end
0069
0070
0071 for ii = 1:length(full_name_color_style)
0072 idx = strfind(copy_str, full_name_color_style{ii});
0073 if ~isempty(idx)
0074 copy_str = strrep(copy_str, full_name_color_style{ii}, '');
0075 out_color_style = full_name_color_style{ii};
0076 found_color_style = true;
0077 break;
0078 end
0079 end
0080
0081
0082 if found_marker_style == false
0083 for ii = 1:length(marker_style)
0084 idx = strfind(copy_str, marker_style{ii});
0085 if ~isempty(idx)
0086 copy_str = strrep(copy_str, marker_style{ii}, '');
0087 out_marker_style = marker_style{ii};
0088 break;
0089 end
0090 end
0091 end
0092
0093
0094 if found_color_style == false
0095 for ii = 1:length(color_style)
0096 idx = strfind(copy_str, color_style{ii});
0097 if ~isempty(idx)
0098 copy_str = strrep(copy_str, color_style{ii}, '');
0099 out_color_style = color_style{ii};
0100 break;
0101 end
0102 end
0103 end
0104
0105
0106 if isempty(copy_str)
0107 ret = true;
0108 else
0109 ret = false;
0110 end
0111
0112 if nargout == 0 || nargout == 1
0113 varargout{1} = ret;
0114 elseif nargout == 2
0115 varargout{1} = ret;
0116 varargout{2} = {out_line_style, out_marker_style, out_color_style};
0117 else
0118 error('### Unknown numbers of outputs.');
0119 end
0120
0121 end