How to assign values in 2 Dimensional Arrays

I have a question on given code. What I want to do is, scaling the matrix by some coefficients.
When I apply the given code the value x cannot be seen in inner while loops.
I tried with global definition. Again, it did not work.
This code is just filling the first column.
I would appreciate any ideas.
Thanks!
P.S.Matrix structure is like:
a1 b1 a2 b2 a3 b3 ...
1
2
3
4
...
Altered flac_matrix values will be stored at preprocessed_matrix.
Code starts here:
while x<2203
while y<224911
preprocessed_matrix(y,x)= alpha*flac_matrix(y,x);
y=y+1;
end
x=x+1;
while y<224911
x_=x;
preprocessed_matrix(y,x)=beta*flac_matrix(y,x);
y=y+1;
end
x=x+1;
end

1 Comment

"... When I apply the given code the value x cannot be seen in inner while loops. ..."
What do you mean by this? Are you getting an error message? If so, please post it. Or is the value not what you expected? Or what?
Also, it is a bit confusing what you intend this code to do. The first inner while loop exits when the y<224911 test fails. So how then is the second inner while loop ever going to execute since it has the same test? Are you simply trying to scale a column of a matrix and assign it to a column of another matrix?

Sign in to comment.

Answers (0)

Asked:

on 5 Jul 2016

Edited:

on 5 Jul 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!