Matlab Doesn't Recognize Fits Files (evalin, sprintf)?
Mostrar comentarios más antiguos
I need my script to read in five images (capture_667.fit... capture_671.fit), and name them image667... image 671. I have the following code:
for j = 667:671
evalin('base', sprintf('[ image%03d ] = fitsread(capture_%03d.fit);', j, j));
end
However, I get this error message:
.
'Undefined variable "capture_667" or class "capture_667.fit".
Error in Try_Sprintf_Evalin_New (line 5) evalin('base', sprintf('image%03d = fitsread(capture_%03d.fit);', j, j));'
.
All of the files I'm trying to read in are in the right folder. Furthermore, if I try to open these files manually, I get this message:
.
'Error using open (line 162) CFITSIO library error (412); datatype conversion overflow'
.
What's stopping my code from working? And what is a datatype overflow? I've looked online for a definition but with no luck.
NB: This task was set by demonstrators at university. I HAVE to complete it using sprintf, evalin, and fitsread.
Respuesta aceptada
Más respuestas (2)
Walter Roberson
el 16 de Nov. de 2015
0 votos
If you need your code to do that, then it is time to renegotiate the requirements with who-ever imposed that constraint. Creating variables on the fly is not recommended at all.
3 comentarios
MC
el 16 de Nov. de 2015
Walter Roberson
el 16 de Nov. de 2015
Well now you begin to see why we do not recommend using eval() or evalin() .
Is the requirement definitely for evalin()? You cannot use assignin() instead?
MC
el 16 de Nov. de 2015
Categorías
Más información sobre Image Category Classification 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!