Converting number to string in a cell data ?

6 visualizzazioni (ultimi 30 giorni)
I have a code like that:
data={'class' 'note 1' 'note 2' 'note 3' 'note 4' 'note 5' ;...
'math' 50 45 68 75 64; ...
'physics ' 67 54 67 89 90; ...
'chemistry' 45 76 23 76 89;
'physics ' 32 45 65 76 93;
'math' 54 76 34 54 56};
[row_data column_data] = size(data);
math_finder = 'math';
row_finder = strfind(data, math_finder);
row_number = find(~cellfun('isempty',strfind(data,'math')));
for i = 1:length(row_number)
classmath_note1(i)=data(row_number(i),2);
classmath_note2(i)=data(row_number(i),3);
classmath_note3(i)=data(row_number(i),4);
classmath_note4(i)=data(row_number(i),5);
classmath_note5(i)=data(row_number(i),6);
end
I want to classify math class notes. I mean, at the end, work space should be like that:
Name - Value
classmath_note1 = [50 54]
classmath_note2 = [45 76]
classmath_note3 = [68 34]
classmath_note4 = [75 54]
classmath_note5 = [64 56]
However, I receive this error:
If any of the input arguments are cell arrays, the first must be a cell array of strings and the second must be a character array.
How can I solve this problem ?
Thank you in advance

Risposta accettata

Image Analyst
Image Analyst il 10 Set 2014
Use a table. It would be so much easier than a cell array. http://www.mathworks.com/help/matlab/ref/table.html Let us know if you can't figure it out.
  1 Commento
Ugurcan Ozdemir
Ugurcan Ozdemir il 10 Set 2014
Modificato: Ugurcan Ozdemir il 10 Set 2014
Actually, the issue is that I read the data from xlsx. file, I do not create the data. And when i read the data from excel, I have a data like that.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by