Cell 'Find And Replace'
by Yoav Mor
24 Apr 2006
(Updated 26 Apr 2006)
Finds all occurrences of NaN in a cell array and replaces them.
|
Watch this File
|
| File Information |
| Description |
cellData=cellNaNReplace (cellData, replaceWith)
Accepts a cell array and a char/integer and replaces all occurrences of NaN in that cell array with the 'replaceWith' value. This is especially useful when using 'readfromexcel' or other excel importers since they sometimes put NaN instead of empty cells.
Example of usage:
a = num2cell([0 1 2 NaN 4]);
b = cellNaNReplace (a,'');
or, if you're dealing with excel spreadsheets, you can use:
Data = readfromexcel(File,'All');
Data = cellNaNReplace (Data,0);
Enjoy. |
| Acknowledgements |
The author wishes to acknowledge the following in the creation of this submission:
readfromexcel
|
| MATLAB release |
MATLAB 7.1.0 (R14SP3)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (3) |
| 08 Aug 2006 |
Sebastian Walderich
|
|
|
| 18 Apr 2007 |
Arya Bolurfrushan
|
|
|
| 21 Sep 2007 |
fan houjun
|
|
|
|
Contact us at files@mathworks.com