Identical random on two arrays

5 views (last 30 days)
Kasper
Kasper on 2 May 2014
Commented: Kasper on 2 May 2014
Hello!
I'm making a True/False-quiz during a MatLab course. My problem is, is that I have to make it able to take the questions in a random order. My questions and answers are stored in different cell array. So I have to make shuffle the order of the questions, but the answers has to be shuffled excatly as the questions. Is there a way to do that?
Thank you in advance

Accepted Answer

Cedric
Cedric on 2 May 2014
Edited: Cedric on 2 May 2014
Use RANDPERM to generate an index vector, that you use then to index both cell arrays.
  1 Comment
Kasper
Kasper on 2 May 2014
Thank you very much!
I then used sortedcellarray = cellarray(indexarray) for indexing my cell arrays so they match.

Sign in to comment.

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!