How to choose only certain values my matrix answer
3 次查看(过去 30 天)
显示 更早的评论
Hi. Grateful for any help please.
My output is in matrix, say 400 563 674 904 789
Now i want to use 563 to 904, as a matrix in another algorithm without me redefining it.
Many thanks
0 个评论
回答(2 个)
David Hill
2019-9-12
A=[400,563,674,904,789];
B=A(A>=563&A<=904);
3 个评论
David Hill
2019-9-14
My B above gives you that output. If you want a column vector just add an apostrophe.
A=[400,563,674,904,789];
B=A(A>=563&A<=904)';
Walter Roberson
2019-9-14
A=[400,563,674,904,789];
idx1 = find(A>=563, 1, 'first');
idx2 = find(A>=904, 1, 'first');
A(idx1:idx2)
but I suspect what you might be looking for is:
A(2:end-1)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pulsed Waveforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!