loading info from one code into another

3 visualizaciones (últimos 30 días)
Shane Gibbs
Shane Gibbs el 28 de Feb. de 2019
Respondida: Star Strider el 28 de Feb. de 2019
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!

Respuestas (1)

Star Strider
Star Strider el 28 de Feb. de 2019
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.

Categorías

Más información sobre Number games en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by