loading info from one code into another

4 vues (au cours des 30 derniers jours)
Shane Gibbs
Shane Gibbs le 28 Fév 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!

Réponses (1)

Star Strider
Star Strider le 28 Fév 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.

Catégories

En savoir plus sur Conway's Game of Life dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by