Loop problem

2 views (last 30 days)
Pieter
Pieter on 30 May 2011
Hello, I have a loop problem in Matlab
Consider the following datasets:
models = 5x10 (5 rows, 10 columns)
bsdata = 5x20 (5 rows, 20 columns)
I want to do the following calculation:
Result=models(bsdata);
If I do so, I obtain a 5x20 dataset. How can I do this for all the 10 columns of models? I would like to obtain a 10x200 dataset? I have tried the following, but it doesn’t work:
for i=1:10
Result=models(:,i)(bsdata);
end
Thanks,
Pieter
  6 Comments
Oleg Komarov
Oleg Komarov on 30 May 2011
Still not clear why you have a matrix for bsdata instead of a vector. How are you gonna draw a 5 by 20 matrix from a 5 by 30?
Pieter
Pieter on 30 May 2011
You are right, it are vectors. I was using the wrong word.

Sign in to comment.

Accepted Answer

Oleg Komarov
Oleg Komarov on 30 May 2011
Then:
Result = models(bsdata,:);
You will draw rows direclty fro models.

More Answers (0)

Categories

Find more on Measurement-Level Simulations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!