필터 지우기
필터 지우기

categorical indices in for loop

조회 수: 4 (최근 30일)
Sarah Ansari
Sarah Ansari 2018년 9월 13일
댓글: Amir Xz 2018년 9월 17일
I have different sets with categorical data in them and I want to use them in for loop. Below is an example:
S = {'S1'; 'S2'}; T = {'T1'; 'T2'}; N = union(S,T);
Then I need to use i index in set of N once and in set of S in another for loop. I mean instead of for i= 1:n I need to say something that the for loop understands that i should only be in set S or in set N. I hope my question is clear. How can I do that? I appreciate any help on this.
  댓글 수: 4
Walter Roberson
Walter Roberson 2018년 9월 14일
for i=1:length(S)
for j=1:length(T)
Amir Xz
Amir Xz 2018년 9월 17일
When you write:
S = {'S1'; 'S2'};
S has two characters : 'S1' and 'S2'
But you said "I have different sets with categorical data".
The question is: Are S1 and S2 set of numbers and you wanted to group them as S? Or just really two char as 'S1' & 'S2'?
Please, give more details about S1, S2, T1 and T2.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by