MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by tzaloupas on 4 Feb 2013

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

*No products are associated with this question.*

## 3 Comments

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/62181#comment_127133

Note: You can omit the

findin your code.Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/62181#comment_127139

thanks

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/62181#comment_127217

I am still struggling how to do it. could pelase some help me?

thanks