>> varName1 = dataset1.Properties.VarNames(idx1);
>> cellData1 = dataset2cell(dataset1(:,idx1));
>> data1 = cellData1(2:end,2);
>> data1 = cellfun(@num2str,data1,'UniformOutput',false);
>> ds1 = dataset(data1,'Varnames',varName1,'ObsNames',dataset1.Properties.ObsNames);
>> dataset1(:,idx1) = ds1;
>> varName2 = StatSet.Properties.VarNames(idx2);
>> cellData2 = dataset2cell(dataset2(:,idx2));
>> data2 = cellData2(2:end,2);
>> data2 = cellfun(@num2str,data2,'UniformOutput',false);
>> ds2 = dataset(data2,'Varnames',varName2,'ObsNames',dataset2.Properties.ObsNames);
dataset2(:,idx2) = ds2;
C = join(dataset1,dataset2,'Key','key1');
Best Answer