Frage

I am converting a .tif image to double format, and the new filename is stored in a variable. When typing the save command, the script executes but the file is not saved unless I manually type 'New-file-name.dat' into the save command (in place of the variable). That is, the variable in the save command is not working.

Am I missing something I'm doing wrong here?

CODE BELOW

%user image selection    
[imagerawname imagerawpath] = uigetfile('*.tif', 'Double Convert - Select raw image file', directory);    
%create image location string    
imageloc = strcat(imagerawpath, imagerawname);    
pack    
%read and convert to double    
image=imread(imageloc);    
imagedbl=double(image);   
%save as .dat file    
savepath = strcat(imagerawpath, imagerawname(1:(end-4)), '-Dbl', '.dat')    
save 'savepath' imagedbl -ascii    
fprintf('\nDouble conversion saved.\n')
War es hilfreich?

Lösung

Looks to me like you are saving to a file named 'savepath'. Try this:

save (savepath, 'imagedbl', '-ascii')
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top