Why does streamslice not work with single precision data?
2 views (last 30 days)
Show older comments
I was having issue plotting streamlines using stream slice, and I tracked it down to the fact that the X,Y,U,V data I was using was single precision. I modified it from double precision because the source of the data is the result of post processing data, and I wanted to conserve space. (Talking potentially TB of data). But, now all my data crunching appears useless if I want to plot streamlines, since I can't seem to use Single precision data.
I either would like to know how to use streamslice with single precision data, or know how to save structures of data from matlab to a file and truncate the numbers in the arrays being saved. I dont need double precision to represent 1.35 in an array.
0 Comments
Answers (1)
per isakson
on 27 Feb 2014
Edited: per isakson
on 27 Feb 2014
It looks like a bug to me (R2013a).
An example from the documentation works fine with double, but produces nothing but the default empty axes with single. There is no error message or warning.
load wind
figure
streamslice(x,y,z,u,v,w,[],[],[5])
axis tight
figure
streamslice(single(x),single(y),single(z),single(u) ...
,single(v),single(w),single([]),single([]),single([5]))
axis tight
.
Workaround
figure
streamslice(double(x),double(y),double(z),double(u) ...
,double(v),double(w),double([]),double([]),double([5]))
axis tight
- or make a wrapper. Not tested
function streamslice4single( X,Y,Z,U,V,W,startx,starty,startz )
x = double(X);
y = double(Y);
z = double(Z);
u = double(U);
v = double(V);
w = double(W);
sx = double( startx );
sy = double( starty );
sz = double( startz );
streamslice(x,y,z,u,v,w,sx,sy,sy)
end
See Also
Categories
Find more on Volume Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!