필터 지우기
필터 지우기

How to get the matrix when I need a logic matrix

조회 수: 3 (최근 30일)
PRED LIU
PRED LIU 2020년 5월 21일
댓글: Steven Lord 2020년 5월 21일
How to get a matrix QQQQ when I need a logic matrix AAAA
AAAA=[
true true true true false true true
true true true true false true true
true true true true false true true
true true true true false true true
]
y=[
0.0246 0.4415 0.0274 0.0269 0.0264 0.0255 0.0557
0.4535 0.0260 0.4495 0.4455 0.0563 0.0566 0.0569
0.0251 0.0542 0.0545 0.0548 0.0551 0.0554 0.0563
1.0000 0.1615 0.0061 0.0156 0.0692 0.1323 0.0001
]
QQQQ
[
0.0246 0.4415 0.0274 0.0269 0 0.0255 0.0557
0.4535 0.0260 0.4495 0.4455 0 0.0566 0.0569
0.0251 0.0542 0.0545 0.0548 0 0.0554 0.0563
1.0000 0.1615 0.0061 0.0156 0 0.1323 0.0001
]

채택된 답변

David Hill
David Hill 2020년 5월 21일
  댓글 수: 1
Steven Lord
Steven Lord 2020년 5월 21일
That works as long as all elements in y are finite.
Inf*false
I'd use logical indexing.
QQQQ = zeros(size(y));
QQQQ(AAAA) = y(AAAA);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by