Why does streamslice not work with single precision data?

7 visualizaciones (últimos 30 días)
Keith Taylor
Keith Taylor el 27 de Feb. de 2014
Comentada: Keith Taylor el 28 de Feb. de 2014
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.

Respuestas (1)

per isakson
per isakson el 27 de Feb. de 2014
Editada: per isakson el 27 de Feb. de 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
  1 comentario
Keith Taylor
Keith Taylor el 28 de Feb. de 2014
Thank you for the response. It came to me about a minute before I saw this reply. This work around does work.

Iniciar sesión para comentar.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by