function [result] = mat5CIXYZwrite2011(matfile,imageC,imageI,xw,yw,zw); % open the world coordinate files fnameC = strcat(matfile,'C.bmp'); fnameI = strcat(matfile,'I.bmp'); fnamex = strcat(matfile,'X.byt'); fnamey = strcat(matfile,'Y.byt'); fnamez = strcat(matfile,'Z.byt'); %get the dimensions [My,Nx,Pz] = size(imageI); %reshape the 1D world coordinate vectors Nindex=Nx*My; %C imwrite(imageC,fnameC,'bmp'); %I imwrite(imageI,fnameI,'bmp'); x = reshape(xw',1,Nindex)'; y = reshape(yw',1,Nindex)'; z = reshape(zw',1,Nindex)'; %xw fpx = fopen(fnamex,'wb'); fwrite(fpx,x,'float32');fclose(fpx); %yw fpy = fopen(fnamey,'wb'); fwrite(fpy,y,'float32');fclose(fpy); %zw fpz = fopen(fnamez,'wb'); fwrite(fpz,z,'float32');fclose(fpz); % result = 1;