Clear Filters
Clear Filters

how do you ask matlab for a random word from dictionary?

4 views (last 30 days)
randWord=randi(length(dictionary));
i tried using the code above and it gives me number instead of a word from the dictionary

Accepted Answer

KSSV
KSSV on 2 May 2019
idx=randperm(length(dictionary),1);
randword = dictionary{idx}

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!