Hello, I have two difficulties with my script, the first is that I have vectors with different size et I want to create a matrix and then to fill with my different vectors but I think I do the wrong thing with Mat=[ 10000,11] . The other thing is that I want clearly to suppress all NAN in my matrix only in my vector TR_NAN. Have you an idea please?
filename = 'C:\Users\williot\Dropbox\UQTR 2013 - 2015\E-Prime\exp 2 ÉNPQ\eye-tracking\données brutes 30 aspirants\test_matlab.xlsx';%'E:\exp 2 ÉNPQ bis\Cueing + TRV\test_script_matlab.xlsx';
[num,txt,raw] = xlsread(filename);%--création matrice Mat---------------------------------------------
Sujets = num(:,1);Essais = num(:,30);%82
TR_NAN = num(:,115);%104
TR_acc = num(:,112);%101
validite = txt(:,147);%138
contenu = txt(:,112);%101question = txt(:,143);%134
procedure = txt(:,137);%68
bloc = txt(:,95);%84
running = txt(:,92);%137
Data_OK = [];% Mat = [1009 138]
Mat=[]Mat=[10000,11]Mat = [Sujets Essais TR_NAN TR_acc Data_OK validite ... contenu question procedure bloc running];Mat(isnan(Mat(:,3)),:) = [];%===================================================================
%--exclusion des TR à + ou - 2ET------------------------------------
for suj = 1 :length (Sujets); Moy_TR = mean (TR_NAN); ET_TR = std(TR_NAN); Data_OK = TR_NAN((TR_NAN>Moy_TR-2*ET_TR) & (TR_NAN>Moy_TR+2*ET_TR));end%--CONSTRUCTION D'UN FICHIER DE SORTIE-------------------------
%Création de la Matrice finale------------------------------------------------
Mat_out = [Sujets Essais TR_NAN TR_acc Data_OK validite ... contenu question procedure bloc running];%--nom fichier------avec excel titre col---------------------
path_and_name_file='PREP_extremes.txt';%--ouverture fichier
fid=fopen (path_and_name_file,'wt');%titre colonne-----------------------------------------------
fprintf(fid,'Sujets;Essais;TR_NAN;TR_acc;Data_OK;validite;contenu; ... question;procedure;bloc;running');fprintf(fid,'\n');%écriture
for n=1:length(Mat_out); fprintf(fid,'%d;%d;%d;%d;%d;%s;%s;%s;%s;%s;%s',Mat_out(n,:)); %1.4f;%1.4f;%1.4f;%1.4f;%1.4f;%1.4f;%1.4f;%1.4f;',Mat_out(n,:));
fprintf(fid,'\n');endfclose(fid);
Best Answer