Info

此问题已关闭。 请重新打开它进行编辑或回答。

Only show values below a maximum

1 次查看(过去 30 天)
Olli
Olli 2011-9-8
关闭: MATLAB Answer Bot 2021-8-20
Hi, I have a huge matrix with the time and values that I measured, e.g:
matrix =
0 153
1 631
2 512
3 132
4 523
5 1326
Now I only want to give out those values that are <600 (below a defined maximum) and the time belonging to them, so that I would get:
ans =
0 153
2 512
4 523
Is there any MATLAB command solving this problem without using 'while'?
Best regards! Oliver
  1 个评论
Jan
Jan 2011-9-8
This is a standard procedure in Matlab. I suggest to read the Getting Started chapters in the documentation.
BTW. how does your WHILE approach look like?

回答(1 个)

Andrei Bobrov
Andrei Bobrov 2011-9-8
mtx =[ 0 153
1 631
2 512
3 132
4 523
5 1326]
out = mtx(mtx(:,2)<600,:)

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by