MATLAB: Two variables need to be connected to one struct variable. structures two variable need to be connected to one structure. ie… Results.Name= lastname{target}, firstname{target} THey come from two different sheets. I just cannot seem to write it in correctly for the code to run. Best Answer What about something like this:Results.First_Name = first_name{target};Results.Last_Name = last_name{target}: Related SolutionsMATLAB: How do you search a file for a matching string [num,text,v]=xlsread('yourfile')s1='firstname';s2='lastname';idx=find(strcmp(v(:,1),s1) & strcmp(v(:,2),s2)Id=v(idx,3)Email=v(idx,4) MATLAB: Concatenating strings w/ character with while loops >> myname = 'Nate Johnson';>> split(myname)ans = 2×1 cell array {'Nate' } {'Johnson'}>> presuming the next step would be to also isolate lastname.Or, alternatively>> firstname=extractBefore(myname,' ')firstname = 'Nate'>> Related QuestionHow to print : What’s Your NameTable row not selectingRead data from file and print information for whom has the required criteria
Best Answer