mtx2charcell
by Gerald Dalley
15 Feb 2006
(Updated 21 Feb 2006)
Converts a matrix of numbers into a cell array of strings.
|
Watch this File
|
| File Information |
| Description |
%charcell = mtx2charcell(mtx)
% Converts a matrix of numbers into a cell array of strings of the same
% dimensionality as MTX.
%charcell = mtx2charcell(mtx,fmt)
% Uses the format string FMT (see SPRINTF for details).
%
%This function serves as a shorthand for using the built-in NUM2CELL,
%NUM2STR, and RESHAPE commands together (thanks Urs Schwarz!)
%
%EXAMPLES:
% mtx2charcell([0 1 2]) --> {'0.000000', '1.000000', '2.000000'}
% mtx2charcell([0 1 2], '%d') --> {'0', '1', '2'}
%
%This function can be handy to use in conjunction with the author's JOIN
%function (also available on Matlab Central). For example,
% join('-', mtx2charcell([0 1 2], '%d')) --> '0-1-2'
%
%CHANGES:
% 2006-02-16 6pm: even better performance enhancement, thanks to Urs Schwarz
% 2006-02-16 afternoon: performance enhancement thanks to Jiro Doke. |
| MATLAB release |
MATLAB 7.0.4 (R14SP2)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (4) |
| 16 Feb 2006 |
Jiro Doke
|
|
|
| 16 Feb 2006 |
Jiro Doke
|
|
|
| 16 Feb 2006 |
urs (us) schwarz
|
|
|
| 28 Feb 2006 |
Jiro Doke
|
|
|
| Updates |
| 17 Feb 2006 |
Added optimization inspired by Jiro Doke's suggestion. |
| 17 Feb 2006 |
Changed the implementation to expand on a suggestion by Urs Schwarz that cleans it up and keeps it fast. |
| 17 Feb 2006 |
Changed the implementation to expand on a suggestion by Urs Schwarz that cleans it up and keeps it fast. |
| 17 Feb 2006 |
Changed the implementation to expand on a suggestion by Urs Schwarz that cleans it up and keeps it fast. |
| 21 Feb 2006 |
Removed boilerplate copyright. |
|
Contact us at files@mathworks.com