MATLAB: How to use multisurf to plot 3 surfaces on one plot

multisurf

Hi there, I am new to matlab and am trying to use the multisurf tool to plot 3 surfaces on one plot. I have been using the code below but keep getting the error messages –
Error using matlab.graphics.chart.primitive.Surface/set Invalid parameter/value pair arguments.
Error in matlab.graphics.chart.internal.ctorHelper (line 8) set(obj, pvpairs{:});
Error in matlab.graphics.chart.primitive.Surface
Error in surf (line 139) hh = matlab.graphics.chart.primitive.Surface(allargs{:});
Error in multisurf (line 46) h(i) = surf(x{i},y{i},z{i});
Code used:
filename = 'b1_b4_sqr_clp.txt'; delimiterIn = ' '; headerlinesIn = 6; A = importdata(filename,delimiterIn,headerlinesIn);
filename = 'b1_af_sqr_clp.txt'; delimiterIn = ' '; headerlinesIn = 6; B = importdata(filename,delimiterIn,headerlinesIn);
filename = 'b2_af_sqr_clp.txt'; delimiterIn = ' '; headerlinesIn = 6; C = importdata(filename,delimiterIn,headerlinesIn);
[xs,ys] = meshgrid(0:0.001:5.799);
A = num2cell(A.data); B = num2cell(B.data); C = num2cell(C.data);
x = {xs xs xs}; y = {ys ys ys}; z = {A B C}; color = {'r','g','b'}; multisurf(x,y,z,color)
Any help would be appreciated. Thank you!

Best Answer

Do not use num2cell on the data you are bundling. Just A = A.data and so on.