I found an error when using this in 2013a occasionally when rotating the plane it would give me coordinates outside of the volume and thus return NaNs. I found changing line 95 to
fixes the problem by specifying the origin when rotating.
Thank you very much! I really appreciate your work.
I downloaded the updated function and tested it. Yes, it gave me the unrounded xd (subX), yd (subY) and zd (subZ) which I needed. Great! Thanks!
Since I also need the values of the extracted plane from subX, subY and subZ (sorry for not metioning it in my previous email), I added the line to extractSlice before "for" loop,
h = slice(volume, subX, subY, subZ);
For a point on the plane, plane(i,j), I can get its coordinate [subX(i,j), subY(i,j) subZ(i,j)].
Hope what I did makes sense to you. I am happy to hear your comments.