Must be a string scalar or character vector.

What's wrong with this?
for indx=1:15 %automatically crop them, and create new cropped dicom images.
A = dicomread(strcat( 'D:\stelios phd files\DesMoines\' , int2str(indx),'.dcm'));
A=double(A)
end
loaded = load(A);
Error at last line "loaded = load(A);"

 Respuesta aceptada

Rik
Rik el 7 de Mayo de 2018

0 votos

You already read the dicom file to variable A, and then converted that to a double. Each loop iteration you are overwriting this result. After the loop you try to use this array as if it is a file name.
It is not clear what your goal is, but you probably want to index that variable A, and you need to read the doc for load and decide what you want to do.

4 comentarios

Stelios Fanourakis
Stelios Fanourakis el 7 de Mayo de 2018
Yes I need to index it. Any idea of how to do that?
Stelios Fanourakis
Stelios Fanourakis el 7 de Mayo de 2018
Now I get this error "Struct contents reference from a non-struct array object"
I can't debug code I can't see. As for your loop, what you need to write depends on your goal. The code below should work at least.
A=cell(1,15);
for indx=1:15 %automatically crop them, and create new cropped dicom images.
A{indx} = dicomread(strcat( 'D:\stelios phd files\DesMoines\' , int2str(indx),'.dcm'));
A{indx}=double(A{indx})
end
Stelios Fanourakis
Stelios Fanourakis el 7 de Mayo de 2018
Editada: Stelios Fanourakis el 7 de Mayo de 2018
Thanks for the help. It was a silly error I did. It was too obvious and I couldn't see it

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Centro de ayuda y File Exchange.

Preguntada:

el 7 de Mayo de 2018

Editada:

el 7 de Mayo de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by