Suppose I have the following two variables:
start_idx = [1 4 7];
end_idx = [2 6 15];
I want to efficiently (no for loop if possible) generate a single row which consists of the colon operator being applied between corresponding elements of start_idx
and end_idx
. For this example, this would result in:
result = [1:2 4:6 7:15];
Therefore:
results = [1 2 4 5 6 7 8 9 10 11 12 13 14 15];
The method to do this should be usable inside Simulink's MATLAB Function block. Thank you very much!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…