loading info from one code into another

3 次查看(过去 30 天)
Hello! I am trying to create a game , and am having a little bit of trouble.
I have stored data for some characters that I would like to have in the game.
The issue is that I cannot seem to load said data into the story game mode.
for example...
File 1:
classdef Brute
properties
EnemyCall = 'Brute'
EnemyHealth = 20
EnemyAttack= 10
EnemyEvasion = 5
File 2:
classdef Human
properties
EnemyCall = 'Human'
EnemyHealth = 10
EnemyAttack = 15
Enemy Evasion = 25
From there, I wanted to load one of the two files into another file, and have their stats be transferred over as well.
I have only started using Matlab for about 4 months, so I am not very experienced at all. If you could make it simple, that would be great! If not, Ill try it out, but it may not be successful.
Thank you!

回答(1 个)

Star Strider
Star Strider 2019-2-28
Your best option is likely to use one or more ‘.mat’ files. See the documentation discussion on Save and Load Workspace Variables (link) for an introduction to them and their use.

类别

Help CenterFile Exchange 中查找有关 Number games 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by