0
votes

I am trying to convert the entire cell array below to cell array of strings and I am using:

C = cellfun(@num2str, final, 'UniformOutput', false);

final = 

    {'3F'   21  'F' '3/26/2014' 'P0702' []  []  []  []  []  []  []  
    '3F'    201 'F' '11/4/2014' 'P0702' 'P0882' []  []  []  []  []  
    '3F'    010 'F' '10/19/2014''P0715' 'P0717' []  []  []  []  []  
    '3L'    014 'M' '12/8/2014' 'P0710' 'P0743' 'P0753' []  []  [] }

It gives me an error

??? Undefined function or method 'fix' for input arguments of type 'cell'.

Error in ==> num2str at 66 if ~isempty(x) && isequalwithequalnans(x, fix(x))

I have tried the required data type conversion but i am missing it somewhere. Any help would be appreciated.Thanks

1
There is problem in your cell array assignment code you provided. Is this how you actually created the cell array final? If I correct the syntax error, the conversion works well. - user3667217
I might have made a mistake in copying it here , are you talking about the syntax Error in the date column last row,if that's the case that's a copy paste error - calib_san
the assignment should be final = {'3F' 21 'F'.....} but not {final} = '3F' 21 'F'.....` - user3667217
Yes , that is how it is! My apologies ,It still gives me the same error ,can I know the class for any row from column 5 .it works fine if I use it from colums 1 to 4 ,it doesn't work from column 5 onwards - calib_san
If that's the case, please post what's in column 5. - user3667217

1 Answers

0
votes

The codes regarding the cell array is not in valid MATLAB syntax. It should be formatted like this:

final = {'3F' 21  'F' '3/26/2014' 'P0702' []  []  []  []  []  [];  
         '3F' 201 'F' '11/4/2014' 'P0702' 'P0882' []  []  []  []  [];
         '3F' 010 'F' '10/19/2014' 'P0715' 'P0717' []  []  []  [] [];
         '3L' 014 'M' '12/8/2014' 'P0710' 'P0743' 'P0753' []  []  [] []}