필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

delete some columns in A and the same columns in another matrix C

조회 수: 1 (최근 30일)
Qian cao
Qian cao 2016년 2월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi all, I have matrix A and C as follows.How to do the function that deletes the columns whose last two values of matrix A are NaN and at the same time delete the same columns in C ? Results expected: a is the new matrix after we delete the columns from A as required. c is the new matrix after we delete the columns from C, with deleted columns indexed as those from A...
a = A(:, ~isnan(a(end-1,:)) | ~isnan(a(end,:)))
helps to get the following results. But I don't know how to get the index of the deleted columns from A so that I can work on C.Thanks.
A =
1 NaN 1 1
1 1 1 1
NaN NaN NaN 1
NaN NaN 1 NaN
a =
1 1
1 1
NaN 1
1 NaN

답변 (1개)

dpb
dpb 2016년 2월 10일
>> idx=all(isnan(A(end-1:end,:)))
idx =
1 1 0 0
>>

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by