Colon operation for numerical string(s)/Print page selection
Parse numerical strings cell array or string with delimiter to a concatenated numerical vector with equal space for each numerical range. What it does is basically the colon operation for strings with concatenation. It is useful for GUI design as per user input or converting data from text file input. All the COLON operation rules apply to this function.
Examples:
numstr2range('1-10') % The output is equivalent to 1:10
numstr2range('1-5,7,9-10') % The output is equivalent to [1:5,7,9:10]. Very much like the print page selection.
numstr2range('1-10','space',0.1) % The output is equivalent to 1:0.1:10
numstr2range('1-10,11-20','space',0.1) % The output is equivalent to [1:0.1:10 11:0.1:20]
numstr2range({'1-10','101-110','50-51,80'},'space',0.1); % The output is equivalent to [1:0.1:10 101:0.1:110 50:0.1:51 80];
numstr2range('1-10,8-12,15-16','space',0.1); % The output is equivalent to [1:0.1:10 8:0.1:12 15:0.1:16];
numstr2range('1-10,8-12,15-16','duplicated',false); % The output is equivalent to unique([1:10 8:12 15:16]);
numstr2range('2-5,1-4','sortoption','descend') % The output is equivalent to sort([2:5 1:4],'descend')
인용 양식
Yung-Yeh Chang (2024). Colon operation for numerical string(s)/Print page selection (https://www.mathworks.com/matlabcentral/fileexchange/50504-colon-operation-for-numerical-string-s-print-page-selection), MATLAB Central File Exchange. 검색됨 .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- MATLAB > Language Fundamentals > Data Types > Numeric Types >
- MATLAB > Language Fundamentals > Data Types > Characters and Strings > String Parsing >
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!