Question: MATLAB// Write a function PlaceStringsFirst to take any sized table as an input, identify all the columns that are strings and position these columns to

MATLAB// Write a function PlaceStringsFirst to take any sized table as an input, identify all the columns that are strings and position these columns to be the first columns in the table. The function should make use of CombineTwoTables and ExtractVariableNames already written. function table_out=PlaceStringsFirst(table_in) % Inputs: table_in: table of any size % Outputs: table_out: table with string columns positioned first columns in the table. end

% Clicker=PlaceStringsFirst(testTable) iClicker=PlaceStringsFirst_refcode(testTable)

+ ExtractVariableNames Function

function [columnVariablesNames, classTypes] =ExtractVariableNames(table_in) % Inputs: table_in: table of any size % Outputs: columnVariables: column variable names in a string row array % classTypes: associated data types in a string row array % % Insert code here

columns = table_in.Properties.VariableNames; columnVariablesNames=strings([1,length(columns)]); classTypes=strings([1,length(columns)]); for i = 1:length(columns) columnVariablesNames(i)=string(columns{i}); classTypes(i)=string(class(table_in.(columns{i}))); end end

+CombineTwoTables Function

function table_out=CombineTwoTables(table_in1,table_in2) % Inputs: table_in1: table of any size % table_in2: table of any size but with same number of rows as % table_in1 % Outputs: table_out: table that combines the two input tables % % Insert code here table_out = [table_in1 table_in2]; end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!