Use Matlab for this problem
23.50: Struct and Direct Field Indexing
Struct and Direct Field Indexing
Write a function ConvertToDecadesAndYears to convert totalYears to decades and years. Return decades and years using a struct that has two fields, one field is named decades and the second is called years. For example:
>> TimeDecadesYears = [];
>> TimeDecadesYears = ConvertToDecadesAndYears(24)
TimeDecadesYears struct with fields:
decades: 2
years: 4
Restriction: ConvertToDecadesAndYears must use direct field indexing
Your Function
function tempVal = ConvertToDecadesAndYears(totalYears)
% your solution goes here %
end
Code to call your function
C Reset