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

1 visualización (últimos 30 días)
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);

Respuestas (1)

Walter Roberson
Walter Roberson el 7 de Abr. de 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

Categorías

Más información sobre Communications Toolbox en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by