How can i work with a matrix that present floating points
1 次查看(过去 30 天)
显示 更早的评论
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')
0 个评论
回答(2 个)
Jon
2020-9-17
编辑:Jon
2020-9-17
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
0 个评论
Star Strider
2020-9-17
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Oceanography and Hydrology 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!