how can I choose values from a vector ascendingly and concequently ?
1 次查看(过去 30 天)
显示 更早的评论
X = [-28.6479 -27.5 -18.33 -13.75 -11 -9.16 -7.85 -6.87 -6.11 -5.5 5.5 6.11 6.87 7.85 9.16 11 13.75 18.33 27.5 28.6479]
0 个评论
采纳的回答
Voss
2022-7-15
X = [-28.6479 -27.5 -18.33 -13.75 -11 -9.16 -7.85 -6.87 -6.11 -5.5 5.5 6.11 6.87 7.85 9.16 11 13.75 18.33 27.5 28.6479]
% choose three consecutive elements from X, starting with element 5:
choice = X(5:7)
2 个评论
Voss
2022-7-15
X = [-28.6479 -27.5 -18.33 -13.75 -11 -9.16 -7.85 -6.87 -6.11 -5.5 5.5 6.11 6.87 7.85 9.16 11 13.75 18.33 27.5 28.6479]
for current_index = 1:numel(X)
choice = X(current_index)
end
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!