While Loops and Criteria
Show older comments
Hi - I'm not sure if I've provided enough information for this but I'll try. I have 4 matrices: easy_matrix, medium_matrix, hard_matrix, expert_matrix. Within these matrices are 9 rows of 1x4 arrays of different topics.(like motion_easy or waves_medium, etc.). All of the 1x4 arrays have specific, but different numbers in them (they don't have identifiers though). If possible, I'd like the final_unshuffled matrix to return in such a way where if, say, easy_matrix pulls motion_easy, none of the others can pull the motion_topic (i.e. medium_matrix can't pull motion_medium). I was thinking of making easy_matrix the reference row so that the other matrices (medium, hard and expert) all have a reference point for a while loop but I couldn't make it work. Any help is greatly appreciated! Thank you in advance :)
easy_matrix = [motion_easy; waves_easy; quantum_easy; radiation_easy; electricity_easy; materials_easy; ef_easy; mf_easy; thermal_easy];
rand_row_easy = easy_matrix(randi(4),:); %Random pull from easy
disp(rand_row_easy)
medium_matrix = [motion_medium; waves_medium; quantum_medium; radiation_medium; electricity_medium; materials_medium; ef_medium; mf_medium; thermal_medium];
rand_row_medium = medium_matrix(randi(4),:); %Random pull from medium
disp(rand_row_medium)
hard_matrix = [motion_hard; waves_hard; quantum_hard; radiation_hard; electricity_hard; materials_hard; ef_hard; mf_hard; thermal_hard];
rand_row_hard = hard_matrix(randi(4),:); %Random pull from hard
disp(rand_row_hard)
expert_matrix = [motion_expert; waves_expert; quantum_expert; radiation_expert; electricity_expert; materials_expert; ef_expert; mf_expert; thermal_expert];
rand_row_expert = expert_matrix(randi(4),:); %Random pull from expert
disp(rand_row_expert)
%You could say, if the rand_row_easy is motion_easy, it
%medium_matrix, hard_matrix, and expert_matrix can't be from the
%motion array.
%LOCATION STAMP
disp('break_1')
fprintf('\n')
disp('Therefore, combining the random pulls:')
%Final, un-shuffled, Matrix:
final_unshuffled = [rand_row_easy; rand_row_medium; rand_row_hard; rand_row_expert];
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!