필터 지우기
필터 지우기

How to write if statement for logical value

조회 수: 1 (최근 30일)
Kamil Kacer
Kamil Kacer 2020년 11월 24일
댓글: Kamil Kacer 2020년 11월 24일
Hi this is my Result matrix I converter them to logical values as shown below(dont know if it is neccecery)
And now I wnat to write if statement
if number of 1s in first column is greater then number 0 give me one else give me 0;
How do i do it for each column.
Thanks
Result{1}(:,1) = logical(Result{1}(:,1));
Result{1}(:,2) = logical(Result{1}(:,2));
Result{1}(:,3) = logical(Result{1}(:,3));

채택된 답변

Walter Roberson
Walter Roberson 2020년 11월 24일
any(Result{1,1}, 1)

추가 답변 (1개)

David Hill
David Hill 2020년 11월 24일
Keep as matrix.
sum(Result)>0;

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by