Stack Exchange
Error while reading dicom spinal cord images in matlab
I am having the error like following
Error using cd
Cannot CD to C:\Users\USER\AppData\Local\Temp (Name is nonexistent or not a
directory).
Error in tempdir (line 31)
    curr_dir = cd(tmp_dir);

Error in tempname (line 18)
    dirname = tempdir;

Error in dicomread>getTempfileName (line 1229)
        tempfiles{p} = tempname;

Error in dicomread>decompressJpegFrame (line 928)
tempfile = getTempfileName;

Error in dicomread>processEncapsulatedPixels (line 798)
    X = decodeFcn(metadata, offset, false);

Error in dicomread>newDicomread (line 215)
    X = processEncapsulatedPixels(metadata, frames);

Error in dicomread (line 80)
[X, map, alpha, overlays] = newDicomread(msgname, frames);

Error in gfjmk (line 9)
                    img = dicomread(char(FN));

My code is X=dicomread(filename)

what does FN look like?

C:\Users\USER\AppData\Local\Temp most likely does not exist or Matlab lacks administrative previliges to access it. Try:

Check for the existence of the directory;

or

On Windos: right click on Matlab and select "Run as Administrator" 


If it worked, would you please mark it as answer? It would increase my reputation.
