Why does streamslice not work with single precision data?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
per isakson
il 27 Feb 2014
Modificato: per isakson
il 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
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!