필터 지우기
필터 지우기

Info

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

creating more efficient loops

조회 수: 2 (최근 30일)
tzaloupas
tzaloupas 2013년 2월 4일
마감: MATLAB Answer Bot 2021년 8월 20일
Dear all,
I have the following lists
A={ 'fi','ffggi'...};
AROT={ 'rttgfi','kil'...};
SEWQW={ 'dfet','vfse'...};
which are replaced by the following lists , respectively
A1={ 'der','gtyhu'...};
AROT1={ 'sdderr','bnhtf'...};
SEWQW1={ 'gbnn','klop'...};
within a cell matrix (named 'raw')
So I have
for k=1:numel(A)
raw(find(strcmp(raw,A{k})))={A1{k}};
end
for k=1:numel(AROT)
raw(find(strcmp(raw,AROT{k})))={AROT1{k}};
end
for k=1:numel(SEWQW)
raw(find(strcmp(raw,SEWQW{k})))={SEWQW1{k}};
end
As you can see I repeat the same process for each list Yet, I have 100 such lists that should be replaced by other 100 lists
Is there any way to construct more efficient loops instead of doing this separately for each list?
thanks
  댓글 수: 3
tzaloupas
tzaloupas 2013년 2월 5일
편집: tzaloupas 2013년 2월 5일
is there a way of constructing efficent loops? I am struggling to find a way but cant. could you please help me?
thanks
tzaloupas
tzaloupas 2013년 2월 5일
I am still struggling how to do it. could pelase some help me?
thanks

답변 (1개)

Doug Hull
Doug Hull 2013년 2월 4일
Your naming convention is what is making this hard for you. I would use a cell array of cells, so you can loop through all the cells doing the same operation.
  댓글 수: 1
tzaloupas
tzaloupas 2013년 2월 5일
can you be more specific?
tbanks

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by