Nice code, but in my case, I can only render a 3D image but can not save the image.
When I use command:
h = vol3d('CData',Y); saveas(h,'Image3D.fig');
Matlab displays it's a 'Invalid handle'
If I save the image directly from figure, it displays:
Warning: Variable 'hgS_070000' cannot be saved to a MAT-file
whose version is older than 7.3.
To save this variable, use the -v7.3 switch.
> In hgsave at 93
In general\private\saveasfig at 7
In saveas at 126
In filemenufcn>localSaveExportHelper at 203
In filemenufcn>localSaveExport at 316
In filemenufcn at 56
And only a figure frame is saved instead of the actual image.