필터 지우기
필터 지우기

Matrix "User Define"

조회 수: 4 (최근 30일)
ANAND ASP
ANAND ASP 2020년 11월 26일
댓글: KSSV 2020년 11월 26일
i wanna make matrix like user define matrix
take input from user but in case user dont know the value, they can put "NO"
user (2,2) dont know the value,
Matrix= 12 45 5
50 NO 63
45 56 66
that value i can read and modified also...

답변 (1개)

KSSV
KSSV 2020년 11월 26일
What you gave is a combination of numbers and strings.....this cannot be acieved by a matrix. But you can use cell arrays for this.
A = [{1} {2} ; {'NO'} {3}] ;
If you want matrix, you can consider repalcing with NaN instead of NO
A = [1 2 ; NaN 3] ;
  댓글 수: 1
KSSV
KSSV 2020년 11월 26일
Yes easily can be changed...you can get the indices of NaN using isnan.
idx = isnan(A) ; % get logical indices of NaN
A(idx) = 3 ;

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

카테고리

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