Identical random on two arrays

3 ビュー (過去 30 日間)
Kasper
Kasper 2014 年 5 月 2 日
コメント済み: Kasper 2014 年 5 月 2 日
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

採用された回答

Cedric
Cedric 2014 年 5 月 2 日
編集済み: Cedric 2014 年 5 月 2 日
Use RANDPERM to generate an index vector, that you use then to index both cell arrays.
  1 件のコメント
Kasper
Kasper 2014 年 5 月 2 日
Thank you very much!
I then used sortedcellarray = cellarray(indexarray) for indexing my cell arrays so they match.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by