colorbar in 3d patch

2 次查看(过去 30 天)
zawaiter
zawaiter 2012-2-6
hi, iam using this function http://www.mathworks.cn/matlabcentral/fileexchange/28497-plot-a-3d-array-using-patch to plot 3D array,it did a great job,but since most of my data are in the range from 0 to 4,i wish i can edit the colorbar and fix it is upper and lower limits to 0 and 4,then any data value bigger than 4 mapped to 4,and data value less than zeros mapped to zero.i would like this change to compare my data values with color.plz some help

回答(2 个)

Walter Roberson
Walter Roberson 2012-2-6
How about if you use
DataToPlot = min( max(YourData, 0), 4);
This will restrict your data to that range before going in to the plotting routine, which would be easier than editing the plotting routine.

zawaiter
zawaiter 2012-2-7
THANK YOU ROBERSON SO MUCH FOR ALL THE HELP,the problem is that my data have nans also and i want them to remain nans for 3d display.so i need something more like mydata(mydata > 4)=4; mydata(mydata < 0 && mydata ~=nan)=0; but i always get matlab error saying ??? Operands to the and && operators must be convertible to logical scalar values. any ideas?

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by