[Num,Txt,Raw]=xlsread......
Mostrar comentarios más antiguos
I used [Num,Txt,Raw]=xlsread to import a matrix containing both numerical and text data and Raw is a 2000*8 cell. When I try to compute eg mean(Raw(.,7)) the following message appears:
??? Undefined function or method 'sum' for input arguments of type 'cell'.
Error in ==> mean at 29 y = sum(x)/size(x,dim);
How can I convert cel into num values?
Thanks
2 comentarios
C.J. Harris
el 15 de Jun. de 2012
Why don't you use the numeric data to compute the mean etc?
Cristina
el 15 de Jun. de 2012
Respuestas (4)
Kye Taylor
el 15 de Jun. de 2012
To convert cell to matrix use the cell2mat functions. For example,
mean(cell2mat(Raw(:,7)))
Andrei Bobrov
el 15 de Jun. de 2012
sum for arguments of type double
eg
mean(Num(:,7));
1 comentario
Cristina
el 15 de Jun. de 2012
Peter Perkins
el 15 de Jun. de 2012
0 votos
Cristina, if you have access to the Statistics Toolbox, you might find that using a dataset array is helpful the kind of thing you seem to be describing. You can read a spreadsheet into a dataset array, and then, for example, compute the mean of one variable conditional on values of other numeric or non-numeric variables.
This example on the File Exchange
seems more or less the kind of thing you are describing.
Syed Zubair shah
el 20 de Mzo. de 2022
what does it means of Num , txt , Raw ... can we just assign it by T =xlsread(filename) ... if yes then how we call specific column then like F is a column of 1600 rows ?
[Num,Txt,Raw] = xlsread(filename)
1 comentario
Image Analyst
el 20 de Mzo. de 2022
Editada: Image Analyst
el 20 de Mzo. de 2022
[Num,Txt,Raw] = xlsread(filename, sheetName, 'F1:F1600');
Categorías
Más información sobre Cell Arrays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!