How can I combine a frequency array and a value array?
1 view (last 30 days)
Show older comments
How can I combine a frequency array and a value array in MATLAB? I have one array that contains values: A=[1 2 3 4 5] And one array that shows the frequency of these values: F=[23 19 34 26 21] How do I combine these into one array?
0 Comments
Answers (1)
Guillaume
on 28 Feb 2015
It's not clear what you're asking. Maybe this?
A=[1 2 3 4 5];
F=[23 19 34 26 21];
cell2mat(arrayfun(@(a, f) repmat(a, [1 f]), A, F, 'UniformOutput', false))
0 Comments
See Also
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!