Conversion to double from cell problem
Mostrar comentarios más antiguos
I need help! I am using the code below to insert values from a text file. The values for this particular part of the text file contain, numbers and string characters. I keep getting a conversion to double from cell not possible error. Thank you,
nodalfix=lineNL-lineNF-1;
for j=1:nodalfix
NFIX = textscan(nf{j,:}, '%f %s %s %f %f', 'delimiter', ',','EmptyValue',-Inf);
NF(j,1) = NFIX{1};
NF(j,2) = NFIX{2};
NF(j,3) = NFIX{3};
NF(j,4) = NFIX{4};
NF(j,5) = NFIX{5};
end
1 comentario
Fangjun Jiang
el 23 de Oct. de 2011
Use {}Code format next time.
Respuestas (1)
Fangjun Jiang
el 23 de Oct. de 2011
0 votos
What is nf{j,:}? If it is the first argument of textscan(), it should be a file Id or text string. That causes the error message. It tries to convert nf{j,:} (which is a cell) to a double (expected file Id).
Categorías
Más información sobre Get Started with MATLAB 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!