%% HOW DO I DO THAT IN MATLAB SERIES?
% In this series, I am answering questions that students have asked
% me about MATLAB.  Most of the questions relate to a mathematical 
% procedure.

%% TOPIC
% How do I display arrays in MATLAB?

%% SUMMARY

% Language : Matlab 2008a; 
% Authors : Autar Kaw and Jeremy Baker; 
% Mfile available at
% http://numericalmethods.eng.usf.edu/blog/displaying_arrays.m; 
% Last Revised : July 8, 2009; 
% Abstract: This program shows you how to display arrays in MATLAB
clc
clear all

%% INTRODUCTION

disp('ABSTRACT')
disp('   This program shows you how to display arrays')
disp(' ')
disp('AUTHOR')
disp('   Autar K Kaw of http://autarkaw.wordpress.com and Jeremy Baker')
disp(' ')
disp('MFILE SOURCE')
disp('   http://numericalmethods.eng.usf.edu/blog/displaying_arrays.m')
disp(' ')
disp('LAST REVISED')
disp('   July 8, 2009')
disp(' ')

%% INPUTS
% Input x and y arrays, for example as y vs x data
x=[1  4  5   7 ];
y=[12  23  34  100];
%% DISPLAYING INPUTS METHOD 1
disp('INPUTS - Method 1')
n=length(x);
fprintf('The number of data points is %g \n',n)
disp('________________________')
disp('  x-values    y values  ')
disp('________________________')
for i=1:1:n
    fprintf('      %g          %g \n',x(i), y(i)')
end
disp('________________________')

%% DISPLAYING INPUTS METHOD 2 
% Suggested by guest blogger Jeremy Baker
disp('  ')
disp('INPUTS - Method 2')
n=length(x);
fprintf('The number of data points is %g \n',n)
disp('________________________')
disp('     x    y  ')
disp('________________________')
dataval=[x;y]';
disp(dataval)
disp('________________________')




