No BSD License  

Highlights from
num2cellstr

5.0

5.0 | 2 ratings Rate this file 7 Downloads (last 30 days) File Size: 2.35 KB File ID: #20639

num2cellstr

by

 

09 Jul 2008 (Updated )

num2CellStr converts numeric or logical array to a cell array of strings

| Watch this File

File Information
Description

num2CellStr - converts numeric or logical array to a cell array of strings

This was inspired by a recent FEX submission of the same name. However,
it should run about 100 times faster. It also runs ~12 times faster than
the one liner:

    cellA = reshape(cellstr(num2str(A(:))),size(A));

Syntax:

strCell = num2CellStr(x, format)

Input parameters:

      x - mandatory matrix of numeric values
      format - optional format specifier. If not specified one is
                  picked based on the data up to 5 decimal places

Output parameters:

      strCell - cell array of strings

Examples:

num2CellStr(rand(2),'%.2f')

ans =

    '0.06' '0.61'
    '0.13' '0.39'

See also:
num2cell, mat2cell, textscan, strread

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
05 Aug 2009 Dirk Engel  
16 Mar 2009 john

Extremely useful! Works just like I thought it would.

Contact us