creating data table with values
Show older comments
Hi guys
I am trying to create a data table in matlab that picks information from each variable at random. The variables don't all have the same amount of rows but each value can be used more than once.
Thanks in advance
Answers (1)
Guillaume
on 14 Mar 2018
What is a data table?
If I understand correctly:
%demo data:
variable1 = [1 3 5 7 9 11 13 15 17]';
variable2 = [100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500]';
variable3 = [10 20 30 40 50 60]';
%random combinations:
numcombs = 10;
randomcombs = [variable1(randi(numel(variable1), numcombs, 1)), ...
variable2(randi(numel(variable2), numcombs, 1)), ...
variable3(randi(numel(variable3), numcombs, 1))]
Categories
Find more on Tables 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!