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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by