Mesh Plot Data Dimensions Error
Show older comments
I am trying to generate a 2D meshplot of the data read in from an excel spread sheet. I keep getting an error that says "Data Dimensions must agree." I am trying to plot x on one axis and then function f1,f2,f3 on the other. My code is below. Please help!!!
s=cell(1,4); %%creating cell array
s{1}='x';
s{2}='f1(x)';
s{3}='f2(x)';
s{4}='f3(x)';
col_header= { 'x' 'f1(x)' 'f2(x)' 'f3(x)'}; %%column headers
s{1}=[0; 1; 2; 3; 4; 5; 6; 7];
s{2}=x.^2;
s{3}=sin(x);
s{4}=cos(x);
filename= 'enel519asst1.xlsx'; %%excel filename
xlswrite(filename, col_header ,'A1:D1');
xlswrite(filename, s{1},'A2:D9');
xlswrite(filename, s{2}, 'B2:D9');
xlswrite(filename, s{3}, 'C2:D9');
xlswrite(filename, s{4}, 'D2:D9');
x=xlsread(filename, 'A2:D9' );
f1=xlsread(filename, 'B2:D9');
f2=xlsread(filename, 'C2:D9');
f3=xlsread(filename, 'D2:D9');
mesh( x, f1, f2, f3);
Answers (0)
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!