How can i work with a matrix that present floating points

1 visualización (últimos 30 días)
Flora Sauerbronn
Flora Sauerbronn el 17 de Sept. de 2020
Respondida: Star Strider el 17 de Sept. de 2020
I'm working with bathymetry data and I need to plot with the 'contour' command only the isolate of -1000. However when I try to find this data in my matrix with the command 'find' the answer I get is: 0x1 empty double column vector. In other words, this number is not being treated with an integer. So I can't work with it with practically no contour commands, like 'levels'. But other values ​​in the matrix are being treated as integers. How can I normalize my data to work with it?
%The code im using
figure
[x,y]=meshgrid(lon_batN,lat_batN,bat_N);
contour(x,y,bat_N,[-1000],'ShowText','on')

Respuestas (2)

Jon
Jon el 17 de Sept. de 2020
Editada: Jon el 17 de Sept. de 2020
I don't think the problem is float versus integer. MATLAB is very forgiving on this. Are you sure that your bat_N values are negative and not positive, ie. 1000 m depth is a positive 1000;
By the way you don't need the square brackets around the -1000 in your argument to contour

Star Strider
Star Strider el 17 de Sept. de 2020
If you want the (x,y) data for that contour, you need to ask contour to give it to you:
c1000 = contour(x,y,bat_N,[-1000],'ShowText','on');
See the documentation for M (contour matrix) under Output Arguments. Note that the actual data begin in the second column of that matrix.

Categorías

Más información sobre Oceanography and Hydrology 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