フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

precise selection in a for loop

2 ビュー (過去 30 日間)
Alexandre Williot
Alexandre Williot 2015 年 7 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello, I just created a for loop and this is correct, but now I would only select positions from 30 to 48 for each "essai" but I am not sur how to do that whithout matrix size problem...
for essai = 1:length (nb_essai)
% for essai = 1:length (nb_essai)
num_ess = [];
num_ess = find (num(:,24) == essai);
Val_CursX_ess = num(num_ess,6);
Val_CursY_ess = num(num_ess,7);
Val_Quest_ess = txt(num_ess,36);
Val_Indice_ess = txt(num_ess,40);
Val_Valid_ess = txt(num_ess,33);

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 7 月 17 日
After
num_ess = find (num(:,24) == essai);
add
num_ess = num_ess(num_ess >= 30 & num_ess <= 48);
  10 件のコメント
Alexandre Williot
Alexandre Williot 2015 年 7 月 19 日
I try something like this but in final I lost information about my 'code_indice'. Is it possible just te redefine the size of matrix num,txt,raw before?
for essai = 1:length (nb_essai)
% for essai = 1:length (nb_essai)
num_ess = [];
num_ess = find (num(:,24) == essai);
%num_ess = num_ess(num_ess >= 30 & num_ess <= 48);
Val_CursX_ess = num(num_ess,6);
Val_CursY_ess = num(num_ess,7);
Val_Quest_ess = txt(num_ess,36);
Val_Indice_ess = txt(num_ess,40);
Val_Valid_ess = txt(num_ess,33);
% pause
%== boucle Question ==
for ques = 1:2
Question_interet = Type_Questions{ques};
[pos_question, index] = ismember ('Semantique', Val_Quest_ess);
%pos_question = find(strcmp(Question_interet,Val_Quest_ess) == 1);
Val_CursX_ess_Quest = Val_CursX_ess(pos_question,1);
Val_CursY_ess_Quest = Val_CursY_ess(pos_question,1);
Val_Quest_ess_Quest = Val_Quest_ess(pos_question,1);
Val_Indice_ess_Quest = Val_Indice_ess(pos_question,1);
Val_Valid_ess_Quest = Val_Valid_ess(pos_question,1);
if ques == 1
pos_ok = [];
[pos_ok, index] = ismember ('Emotion', Val_Quest_ess);
%pos_ok = find(strcmp('Semantique',Val_Indice_ess_Quest) == 0);
Val_Indice_ess_Quest = Val_Indice_ess_Quest(pos_ok,1);
Val_CursX_ess_Quest = Val_CursX_ess_Quest(pos_ok,1);
Val_CursY_ess_Quest = Val_CursY_ess_Quest(pos_ok,1);
Val_Quest_ess_Quest = Val_Quest_ess_Quest(pos_ok,1);
Val_Valid_ess_Quest = Val_Valid_ess_Quest(pos_ok,1);
% faut dégager les semantiques et conserver le reste
% --> créer un nouveau Val_Indice_ess_Quest
end
%-- Etat Indice -- Emo ou Neutre? --
% Code_Indice --> 1 pour Neutre
% Code_Indice --> 2 pour Emo
if strcmp(Val_Indice_ess_Quest(1,:),'Neutre')==1
code_Indice = 1;
elseif strcmp(Val_Indice_ess_Quest(1,:),'Emo')==1
code_Indice = 2;
else
code_Indice = 999;
end
if strcmp(Val_Valid_ess_Quest(1,:),'valide')==1
code_Vald = 1;
elseif strcmp(Val_Valid_ess_Quest(1,:),'invalide')==1
code_Vald = 2;
else
code_Vald = 999;
end
Alexandre Williot
Alexandre Williot 2015 年 7 月 19 日
Maybe, it could be easier if I join the script and a file for run the script for my data

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by