필터 지우기
필터 지우기

how can i negative all rows in a matrix?just rows

조회 수: 1 (최근 30일)
fariba amini
fariba amini 2016년 5월 7일
댓글: Jan 2016년 5월 7일
how can i negative all rows in a matrix?just rows
  댓글 수: 3
John D'Errico
John D'Errico 2016년 5월 7일
One can only presume that the OP is asking how to negate an array. But then why would that negate only the rows, and not the columns?
Jan
Jan 2016년 5월 7일
@fariba amini: Please post a small example which explains, what "negative rows" means and how if differs from negate the elements.

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

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2016년 5월 7일
Let a - your array
a = [-4 0 1 -2 -3
-3 -5 -5 -2 -1
3 2 -3 1 0
-1 3 -5 2 -4
2 1 -5 -4 -4
-4 -1 -2 -1 -1
-2 1 1 -1 3
3 -2 -3 0 -2
2 0 3 1 0
3 -4 -5 1 -3];
out = a(all(sign(a) == -1,2),:);
  댓글 수: 1
Jan
Jan 2016년 5월 7일
This is finding all rows, which contain negative values only.

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

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by