I have a 15x2 matrix that looks like this:
From this matrix, I have to separate the two columns into different variable in column vector form, but I don't need the first row(this is another task I was able to do) and I MUST use a loop per the instructions.
So far, I have:
for l = 1:d
PH1(m) = datain(l);
PH = PH1';
m = m + 1;
m = m - 1;
for k = datain
LA = k(2:15,1);
Technically, this works, somewhat, but I don't think it's what the professor is looking for. Any help would be greatly appreciated.
No products are associated with this question.
for k = 2:length(matrix) var1(k-1) = matrix(k,1); var2(k-1) = matrix(k,2); end %
This runs, but does not do what you expect:
for k = datain LA = k(2:15,1); end
For each element of datain the variable LA is overwritten by the vektor k(2:15,1). Therefore the FOR loop can be omitted.
What is d in your code?
Why do you assume, that the professor wants something else?