i have data in excel spreadsheet want import matlab plot in 3d. want different plot display each row of data. rows b3:p3 through b74:p74. thinking for loop work best, can't syntax right have read data starts when ends.
what have messy because have been trying different things. have far:
datasetstart = xlsread('data.xlsx', 'sheet', 'b3:p3'); datasetend = xlsread('data.xlsx', 'sheet', 'b74:p74'); %what x values %x = dataset(rows, columns) x&y locations of tcs x = xlsread('data.xlsx', 'sheet', 'u3:u17'); y = xlsread('data.xlsx', 'sheet', 'v3:v17'); %specify grid points on mesh grid v_x = linspace(-10,10,50); v_y = linspace(-5,5,50); %build 2d mesh [xx,yy] = meshgrid(v_x,v_y); mesh(xx,yy,ones(50,50)) time_loop = datasetstart:datasetend % subplot(x,y,time_loop); mesh(z,y,time_loop); title('works'); % plot3(x,y,time_loop,'.'); % f2 = figure(1); % zz = griddata(x,y,time_loop,xx,yy); % time = y; end z = xlsread('data.xlsx', 'sheet', 'b3:p3'); plot3(x,y,z,'.'); % imported data zz = griddata(x,y,z,xx,yy); f2 = figure(1); clf; hold on; set(f2, 'renderer', 'zbuffer'); surf(xx,yy,zz); shading flat; %contour3(xx,yy,zz,30) title('thermal plot @ time') %x axis xlabel('x location (inches)') %y axis ylabel('y location (inches)') %z axis zlabel('z temperature (celsius)')
if understand problem correctly, problem not plotting, iterating on rows excel document. can generating range on fly follows:
... %read x , y data = 3:74 range = ['b', num2str(i), ':p', num2str(i)]; z = xlsread('data.xlsx', 'sheet', range); ... % create plots want current z values end
Comments
Post a Comment