How can I print the information (trainer, etc), I am not allow to used display?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2023-4-7
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Communications Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!