How can I write three different size vectors in a matrix ?
Show older comments
I have two different variables and a counter (i) .One of them is a counter result(k). Second one is a function result of the counter(f(k)). All of them a vector but different sizes. The k vector has 9 variables, so function result has 9 component. I want to write them together in a matrix. I show a example below.
i = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
k = 3 5 9 10 11 12 13 15 18
f(k) = 0.1 0.2 0.5 0.7 0.75 0.8 0.82 0.90 0.90
result = [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ;
0 0 3 0 5 0 0 0 9 10 11 12 13 0 15 0 0 18 0 0 ;
0 0 0.1 0 0.2 0 0 0 0.5 0.7 0.75 0.8 0.82 0 0.90 0 0 0.90 0 0 ]
Please help me.
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!