I am trying to make a function that generates a structural array:
function [ schedule ] = addGameStruct( schedule,hometeam,awayteam,homescore,awayscore )%ADDGAMESTRUCT
% schedule is a structure with fields hometeam, awayteam, homescore,
% awayscore, and winner that holds the current data and will be expanded
% to include a new game
% hometeam: home team's final score
% awayscore: away team's final score
%
field1='hometeam'; field2='awayteam';field3='homescore';field4='awayscore';field5='winner';value1=hometeam;value2=awayteam;value3=homescore;value4=awayscore;value5='Cal';%s=struct(field1,value1,field2,value2,field3,value3,field4,value4,field5,value5);schedule={schedule;s};end
However, the above code produces a 2×1 cell array when I would like to produce a structure array. How do I make a structure array?
Best Answer