random selection for .csvfile

1 回表示 (過去 30 日間)
James Webber
James Webber 2022 年 1 月 1 日
回答済み: KSSV 2022 年 1 月 1 日
i have 4 .csvfiles imported into my code like this
Choice1= readtable ('computerchoice1.csv');
Choice2= readtable ('computerchoice2.csv');
Choice3= readtable ('computerchoice3.csv');
Choice4= readtable ('computerchoice4.csv');
how do i wirte code for it to randomly select one of them and to use with the rest of the code

採用された回答

KSSV
KSSV 2022 年 1 月 1 日
csvFiles = dir('*.csv');
N = length(csvFiles) ;
idx = randi(N,1) ;
csvFile = csvFiles(idx).name ;
T = readtable (csvFile);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeVerification, Validation, and Test についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by