- I have a cell array:
A =
'Time' 'Name' 'Location' 'Duration' 'Remarks''100' 'John' 'Abc' '1000' 'Nill''101' 'Tim' 'Def' '1000' 'Nill''102' 'Tom' 'Ghi' '2000' 'Nill''103' 'Jim' 'Jkl' '4500' 'Nill'
Here I want to convert A(2:4, 1), and A(2:4, 4) to numbers and save to same matrice A.
I can do this using a LOOP and STR2DOUBLE(), but it is very time consuming when the matrice is very large.
Is there any method to convert a range of char-values in a cell matrice to to numbers?
I am looking for someting like:
A(2:4, 1) = str2double( A(2:4, 1) ) %This command is not working
A(2:4, 4) = str2double( A(2:4, 4) ) %This command is not working
- Output should look like:
A =
'Time' 'Name' 'Location' 'Duration' 'Remarks'100 'John' 'Abc' 1000 'Nill'101 'Tim' 'Def' 1000 'Nill'102 'Tom' 'Ghi' 2000 'Nill'103 'Jim' 'Jkl' 4500 'Nill'
Best Answer