How can I print the information (trainer, etc), I am not allow to used display?
1 view (last 30 days)
Show older comments
Trainer = struct("Name", [Trai{1}], "Power_Level", [Trai{2}], ...
"Number_of_Pocket_Monsters",[Trai{3}], ...
"Pocket_Monster", [Trai{4}{1},Trai{4}{2},Trai{4}{3}], ...
"Number_of_Wins", [Trai{5}], "Number_of_Losses", [Trai{6}]);
Blastoise = struct("Name",[Poke{1}], "Power_Level",[Poke{4}], ...
"NickName",[Poke{7}],"Number_of_Wins",[Poke{10}],"Number_of_Losses",[Poke{13}]);
Charizard = struct("Name",[Poke{2}], "Power_Level",[Poke{5}], ...
"NickName",[Poke{8}],"Number_of_Wins",[Poke{11}],"Number_of_Losses",[Poke{14}]);
Venusaur = struct("Name",[Poke{3}], "Power_Level",[Poke{6}], ...
"NickName",[Poke{9}],"Number_of_Wins",[Poke{12}],"Number_of_Losses",[Poke{15}]);
%%
Table = struct2table(Trainer);
0 Comments
Answers (1)
Walter Roberson
on 7 Apr 2023
Trai = {'Ash', 11, 5, {'Pich', 'Mozi', 'Thundar'}, 53, 18};
Trainer = struct("Name", [Trai{1}], "Power_Level", [Trai{2}], ...
"Number_of_Pocket_Monsters",[Trai{3}], ...
"Pocket_Monster", [Trai{4}{1},Trai{4}{2},Trai{4}{3}], ...
"Number_of_Wins", [Trai{5}], "Number_of_Losses", [Trai{6}]);
Trainer
TS = structfun(@(F) string(F), Trainer, 'uniform', 0);
arrayfun(@(A,B) fprintf("%s = %s\n", A, B{1}), string(fieldnames(TS)), cellstr(struct2cell(TS)));
0 Comments
See Also
Categories
Find more on Communications Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!