Q:

MATLAB: if..elseif...elseif a lot of times

I need to use elseif statement a lot of times and the elseif depends on the sequence location. 
Say I want to use elseif 100 times:
    if cond1
     action1
    elseif cond2
     action2
    elseif cond3
     action3
    .
    .
    elseif cond101
     action101
    else 
     action102
    end

How to implement it in MATLAB using loop or is there a better more concise function for this purpose?
Also, I have written all the 101 conditions myself and can put them in any structure.

A:

As other comments said, I think you should rethink about the way you handle your data because from the point of view of software engineering that if cascade is bad, really bad.
However, if you have not a better way to express it, you could use two simple features of Matlab that could be really useful: anonymous functions and cell arrays.
The idea is to create a cell arrays of functions, each function gives you the condition you wanted to put inside the if, and you test each function and see which one gives your true.
For example, to test for a number to be less than 0, between 0 and 1, or bigger than 1, you could do:
test_array = {
    @(n) n < 0, 
    @(n) n >= 0 && n < 1,
    @(n) n >= 1
}

then, to test for 0.5, you can just do
for ii =[1:numel(test_array)]
    if(test_array{ii}(0.5)) 
        disp(ii)
    end
end

i tested it on Matlab R2016a and it works.
Hope it helps!

A:

In the comments you seem to mention that generally you will have a set of 101 conditions that are either true or false, and you just want to get the index of the first one that becomes true. 
You don't need ifs for this, definitely not 101 of them. Something like that would work:
conditions=[false true true false ... ]; % E.g. conditions=rand(1,101)<0.2;
% find the first one that is true
index=find(conditions,1,'first');

