필터 지우기
필터 지우기

apply a different condition to 2 columns

조회 수: 1 (최근 30일)
Andres Serrano
Andres Serrano 2018년 11월 2일
댓글: madhan ravi 2018년 11월 2일
Hi guys. I have a matrix 2*2 and I want to apply 1 condition to each column to get a new matrix of the same size. EX a= '0.4317' '0.9203' '0.7011' '0.4612' Condition column 1 = if X<0.5 then Y=1 otherwise y=0. the condition for the second column would be the opposite. following those conditions matrix b= '1' '1' '1''0'.
  댓글 수: 3
Andres Serrano
Andres Serrano 2018년 11월 2일
Hi Stephan!
Andres Serrano
Andres Serrano 2018년 11월 2일
You are right Stephan, my bad!

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

채택된 답변

Bruno Luong
Bruno Luong 2018년 11월 2일
편집: Bruno Luong 2018년 11월 2일
Example from you attached mfile
>> a = [...
0.4317 0.9203
0.0155 0.0527
0.9841 0.7379
0.1672 0.2691
0.1062 0.4228 ]
a =
0.4317 0.9203
0.0155 0.0527
0.9841 0.7379
0.1672 0.2691
0.1062 0.4228
>> a <= [0.5 0.7]
ans =
5×2 logical array
1 0
1 1
0 0
1 1
1 1
>>

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by