MATLAB: Matrix size dependant row and columb headings

Control System Toolboxmatrix titles

Hi im looking to write a code in such a way that a displayed matrix will have columb headings and row titles corresponding to user input variables.
I have got this far
[
m=input('How many simultaneous equations will be input? ');
n=input('what is the number of variables per equation? ');
for i=1:m
for j=1:n
a(i,j)=input('please enter variables in order ');
end
end
disp(a)
printmat(a,1:n)
for k=1:m
b(1,k)=input('please enter equation outputs in order ');
end
disp(b')
end
printmat(a,1:n) gives ascending numerical labels to the rows and columbs but i am looking to name each row Equation 1, Equation 2,..Equation n and the columbs Variable1, Variable2,…variablen dependant on how many rows and columbs are set by the input. Any ideas as to how accomplish this or pointers to where i can find a suitable code?

Best Answer

rowlab = num2str( 1 : size(a,1), 'Equation%d ' ); %note the space after the %d
collab = num2str( 1 : size(a,2), 'Variable%d ' );
printmat(a, 'SomeTitle', rowlab, collab )