surf plot: Z must be a matrix, not a scalar or vector

1 view (last 30 days)
Hi guys,
I am having the error as titled. My problem is a bit different from the others. I have a matrix Res = 33x201x181 which was generated from 3 different parameters. A = 1x33, B = 1x201 and C = 1x181. I want to do a surface plot like
surf(B,C,Res(1,:,:))
But it kept coming with the error of Z must be a matrix. I don't really understand why Res(1,:,:) wasn't recognize as matrix. Thank you for you help.

Answers (1)

Walter Roberson
Walter Roberson on 14 Jul 2017
surf(B, C, squeeze(Res(1,:,:)))

Tags

Community Treasure Hunt

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

Start Hunting!