How can I print the information (trainer, etc), I am not allow to used display?

1 view (last 30 days)
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);

Answers (1)

Walter Roberson
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
Trainer = struct with fields:
Name: 'Ash' Power_Level: 11 Number_of_Pocket_Monsters: 5 Pocket_Monster: 'PichMoziThundar' Number_of_Wins: 53 Number_of_Losses: 18
TS = structfun(@(F) string(F), Trainer, 'uniform', 0);
arrayfun(@(A,B) fprintf("%s = %s\n", A, B{1}), string(fieldnames(TS)), cellstr(struct2cell(TS)));
Name = Ash Power_Level = 11 Number_of_Pocket_Monsters = 5 Pocket_Monster = PichMoziThundar Number_of_Wins = 53 Number_of_Losses = 18

Categories

Find more on Communications Toolbox in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!