creating data table with values
Ältere Kommentare anzeigen
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
Antworten (1)
Guillaume
am 14 Mär. 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))]
Kategorien
Mehr zu Tables finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!