Removing low values from a matrix

조회 수: 62 (최근 30일)
Chris Dan
Chris Dan 2021년 2월 6일
댓글: Jan 2021년 2월 7일
Hi
I have a small problem, I have a 134x10 matrix, which has some noise elemetns. I would like to remove them.
As in the picture below, all elements less than 0.0108 are noise. I am attaching the file
I tried this code
ModeShapes(ModeShapes < 0.01) = [];
but this doesnot works as I want.
Does anybody knows how it can be done
  댓글 수: 5
Chris Dan
Chris Dan 2021년 2월 6일
Okay,
and if I want to remove the rows that have neglible values, how to do that
Jan
Jan 2021년 2월 7일
Exactly as @KALYAN ACHARJYA has posted already, or slightly faster:
X(any(X < 0.0108, 1), :) = [];

댓글을 달려면 로그인하십시오.

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021년 2월 6일
편집: KALYAN ACHARJYA 2021년 2월 6일
Remove menas, you have to replace by other certain values, so that it can be easily distinguishable.
mat(mat<0.0108)=0
or
mat(mat<0.0108)=NaN
More: You cann't completely delete the certain matrix elements (replace option), but you can either delete the certain rows or column easily complete.
  댓글 수: 4
Chris Dan
Chris Dan 2021년 2월 6일
it is not working, I am getting a 0 x 10 matrix.
I am attaching the file
KALYAN ACHARJYA
KALYAN ACHARJYA 2021년 2월 6일
편집: KALYAN ACHARJYA 2021년 2월 7일
Yes, because there are atleast one value (which is less than 0.0108) in each row of ModeShapes matrix, hence it shows the all rows deletion.
Rethink on "yes, I want to delete those rows which are less than 0.01"?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by