Converting Excel columns to a vector
Mostrar comentarios más antiguos
I am trying to access a specific column from different files and convert them into a matrix to be used later but I am running into problems and I'm not sure what I am doing wrong. Here is the part of my code I am trying to do it in, if anyone can tell me what I'm doing wrong I would greatly appreciate it.
for i = 1:3 % Loop over the files
a = xlsread(dataFiles{i}); % Load the data
c = a(:,3); % takes the third column from the file
hf(:,i) = c*(100^2); % converts the values and makes a matrix
end
Is it that I need to convert the cells to a matrix using cell2mat?
3 comentarios
Conrad
el 13 de Jul. de 2012
Could you provide the error message (if any)?
Daniel Jednorozec
el 13 de Jul. de 2012
Nirmal
el 13 de Jul. de 2012
it means that the size of hf and size of c are not same. See the size of both hf and c using size() function.
Respuesta aceptada
Más respuestas (4)
nanren888
el 13 de Jul. de 2012
0 votos
Are the columns always the same length?
If the dimensions, length of hf(:,i) & c are different you may need to consider
hf(ran,k) = c....
Like Conrad said, can you post the error message?
1 comentario
Daniel Jednorozec
el 13 de Jul. de 2012
Editada: Daniel Jednorozec
el 14 de Jul. de 2012
Daniel Jednorozec
el 17 de Jul. de 2012
0 votos
Sidra Khalid
el 22 de Dic. de 2018
0 votos

how i write this program
Sidra Khalid
el 22 de Dic. de 2018
0 votos
this is the remaining part..anyone help me please..is convert it from excel to matlab or matlab to exicel? Categorías
Más información sobre Spreadsheets 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!