MATLAB Answers

How to go from array to table for a variable that has to consider a different table configuration

5 views (last 30 days)
Sophie Blankenheim
Sophie Blankenheim on 30 Jun 2021
I am fairly new to MatLab and I need to convert the non index variables below to a table configuration rather than arrays in order to use the removeOutliersbyWords function but I am not sure how to do so. All the data for all variables is imported from a table that has Agemos, Sex, words, and 5 other variables that are represented by measuretoAnalyze = (i), i = 1:5
FemaleCases1 is what I tried next to what I am modifying it from, it has to consider the corresponding Index in order for the rest of the script to work.
femaleCasesIndex1 = Data(Data.Sex == 1,:);
femaleCases1 = Data(Data.Agemos(femaleCasesIndex1), Data.measureToAnalyze(femaleCasesIndex1),:);%.[AgeColumn(femaleCasesIndex1), DataColumn(femaleCasesIndex1)];
CarsCasesFemaleIndex1 = Data(Data.Sex == 1 & Data.Word == 1,:);
CarsCasesFemale1 = [AgeColumn(CarsCasesFemaleIndex1), DataColumn(CarsCasesFemaleIndex1)];
PopCasesFemaleIndex1 = Data(Data.Sex == 1 & Data.Word == 2,:);
PopCasesFemale1 = [AgeColumn(PopCasesFemaleIndex1), DataColumn(PopCasesFemaleIndex1)];
Duck1CasesFemaleIndex1 = Data(Data.Sex == 1 & Data.Word == 3,:);
Duck1CasesFemale1 = [AgeColumn(Duck1CasesFemaleIndex1), DataColumn(Duck1CasesFemaleIndex1)];
Duck2CasesFemaleIndex1 = Data(Data.Sex == 1 & Data.Word == 4,:);
Duck2CasesFemale1 = [AgeColumn(Duck2CasesFemaleIndex1), DataColumn(Duck2CasesFemaleIndex1)];
VowelCasesFemaleIndex1 = Data(Data.Sex == 1 & Data.Word == 5,:);
VowelCasesFemale1 = [AgeColumn(VowelCasesFemaleIndex1), DataColumn(VowelCasesFemaleIndex1)];
...
[CarsCases1, carscases1_outliersIndices] = removeOutliersbyWords( CarsCases1, measureToAnalyze, 'Agemos',2.576);
[PopCases1, popcases1_outliersIndices] = removeOutliersbyWords( PopCases1, measureToAnalyze, 'Agemos',2.576);
[Duck1Cases1, duck1cases1_outliersIndices] = removeOutliersbyWords( Duck1Cases1, measureToAnalyze, 'Agemos',2.576);
[Duck2Cases1, duck2cases1_outliersIndices] = removeOutliersbyWords( Duck2Cases1, measureToAnalyze, 'Agemos',2.576);
[VowelCases1, vowelcases1_outliersIndices] = removeOutliersbyWords( VowelCases1, measureToAnalyze, 'Agemos',2.576);

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by