# MATLAB: How to put vectors with different size in one matrix and how to suppress the NAN in this matrix

isnanmatrix manipulationnan

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);%82TR_NAN = num(:,115);%104TR_acc = num(:,112);%101validite = txt(:,147);%138contenu = txt(:,112);%101question = txt(:,143);%134procedure = txt(:,137);%68bloc = txt(:,95);%84running = txt(:,92);%137Data_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 fichierfid=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');%écriturefor 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);

Essais =[];    Essais = num(:,93);    Essais(isnan(Essais))=0;    Pos_OK=find(Essais ~= 0);    Pos_OK1=find(Essais == 0);    num=num(Pos_OK,:);    txt= txt(Pos_OK,:);    raw= raw(Pos_OK,:);        Essais = num(:,93);