Hey, I need to know how to pass row vector or column vector as a condition to a switch statement.
I have two row vectors;
function [M,A] = my_vectorsM = [ 1 3 5 9 8 11 12 13 15 17 20 25 29 31.......];A = [ 2 4 7 6 10 14 16 19......... ];end
I need my slover like below:
function my_switch [M,A] = my_vectors;for i = 1:nswitch true case M statement;case A statementendend
Here I know we can use multiple conditions in switch statement like below;
Switch truecase { 1, 3, 5, 9, 8}statement;case { 2, 4, 6, 7}statement;end
But I need to use a n vecotr as a condition in the switch statement since row vector function is being called in the slover(main function).
Here I don't need to enter the number each time to check the number isnumber(b,a) whether the number is there in the vector M or A to exceute the statement like below.
switch truecase ismember(b,M)statement;case ismember(b,A)statement;end
if there is any wrong in my code plz write the comment section along with the answer for my problem.
any suggestion are most welcomed and thanks in advance.
Best Answer