필터 지우기
필터 지우기

using logical to make a logical matrix

조회 수: 3 (최근 30일)
Tor Fredrik Hove
Tor Fredrik Hove 2011년 10월 18일
I wanted to make a logical matrix which consists of some true and some false. This is my attempt to create a 2 rows 3 columns matrix with only true in the forst row and only false in the second row:
vec=[true(1:3);false(1:3)]
but the answer in matlab became something different:
>> vec=[true(1:3);false(1:3)]
vec(:,:,1) =
1 1
0 0
vec(:,:,2) =
1 1
0 0
vec(:,:,3) =
1 1
0 0
what did I do wrong?
  댓글 수: 1
Jan
Jan 2011년 10월 18일
"true(1:3)" means "true([1, 2, 3])"!

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

채택된 답변

Daniel Shub
Daniel Shub 2011년 10월 18일
So close
vec = [true(1, 3); false(1, 3)]

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by