creating data table with values
이전 댓글 표시
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
답변 (1개)
Guillaume
2018년 3월 14일
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))]
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!