function result = plotAll(cellArray) %plotAll given an nx2 cellArray of vectors, plot each row % % consumes: cellArray, a cell array % should be n rows by 2 columns % % each row should contain two numeric row vectors of % equal length, representing x and y % coordinates % % produces: result: true if successful, false if not successful % % Example: Plot the capital letter A in the box with 0,0 at lower % left and 4,8 at upper right. % % % >> myPlot = cell(2,2); % >> myPlot{1,1} = [ 0 2 4 ]; % >> myPlot{1,2} = [ 0 8 0 ]; % >> myPlot{2,1} = [ 1 3 ]; % >> myPlot{2,2} = [ 4 4 ]; % >> plotAll(myPlot); % >> print('-djpeg','myPlot.jpg'); % % P. Conrad for CISC106, 10/16/2007 result = true; [rows, cols] = size(cellArray); % make sure there are exactly two columns if (cols ~= 2) result = false; return; end % make sure that every row contains matrices % of the same length for i=1:rows if (length(cellArray{i,1}) ~= length(cellArray{i,2})) result = false; return; end end % clear the current graphics figure % and make aspect ratio equal on x and y axis close gcf; % plot each line for i=1:rows plot(cellArray{i,1},cellArray{i,2}); hold on; end axis equal tight; end % plotAll.m