 #1
 603
 6
Homework Statement
Homework Equations

The Attempt at a Solution
I've been trying several different ways but I just can't seem to figure this one out. It seems to me like I will need nested for loops, which we haven't learned yet. The way I read the question is that this program needs to be able to solve any arbitrary matrix, which means that it can have x rows and y columns. So I am completely perplexed.
I tried writing a for loop that extracts all the rows into one row:

clc;clear
a=input('enter a matrix: ')
HowBig=size(a);
rows=HowBig(1,1);
columns=HowBig(1,2);
for j=1:rows
a(j)=[a(j,:)]
end

But matlab refuses to run this code because
In an assignment A(I) = B, the number of elements in B and I must be the same.
after running this program I wanted to do another loop like this:

for i=1:length(a)
if i==length(a)
break
end
if a(1,i)<=a(1,i+1)
min_a=a(1,i);
else
min_a = a(1,i+1);
end %if
end %for
disp(num2str(min_a))

Obviously something is really wrong here but I am completely stuck. The second line of code seems to run perfectly well, I just cannot figure out what to do with the first part. Is there any way to pull out the whole Matrix into a single row vector?