creating data table with values
Afficher commentaires plus anciens
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
Réponses (1)
Guillaume
le 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))]
Catégories
En savoir plus sur Tables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!