How to change the scaling back to negative values after applying accumarray function?

I had to impose the accumarray function on two variables, C12 and S12. S12 had negative numbers up to -89 so I had to modify the accumarray function, and input it instead as:
A = accumarray([C12+1, S12+90], 1);
mesh(A)
My question is: now that I plotted the values, how to I change the values of S12 back to their original values within the plot?

回答(1 个)

Wouldn't
mesh(S12, C12, A)
work?

3 个评论

No. Error received:
Error using mesh (line 79)
Data dimensions must agree.
Error in skymaskfinal (line 105)
mesh(S12, C12, A)
C12 - 179 x 361 double
S12 - 179 x 361 double
A - 361 x 179 double
How does accumarray work if C and S are 2D and with that many columns?
Wasn't your code
A = accumarray([C12(:)+1, S12(:)+1], 1)
rather?
Anyway, I didn't think this through properly, this should work (assuming the above A):
mesh(min(S):max(S), min(C):max(C), A)
Basically, you just want to pass to mesh the original range of your S and C.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by