% matlab code to plot data generated by ex1.gms % load data from ex1.dat into the matrix ex1 load ex1.dat % use spconvert to create a matrix A, with ordinate (X axis) as first col, % and the four abscissae as 2nd, 3rd, 4th, 5th columns. A = spconvert(ex1); % add the required shift to get x x = 1990:1990+size(A,1)-1; % make this Figure 1 figure(1); % plot the four graphs, returning a vector of handles % (to which we will later assign legends) h = plot(x,A(:,1),x,A(:,2),x,A(:,3),x,A(:,4)); % fix the ranges on the X and Y axes axis([x(1) x(41) 0 6]); xlabel('Time'); ylabel('A'); % make a legend, "0" allows Matlab to choose its location legend(h,'a','b','c','d',0); title('Example 1: Plot of some GAMS data in Matlab');