loading info from one code into another

4 ビュー (過去 30 日間)
Shane Gibbs
Shane Gibbs 2019 年 2 月 28 日
回答済み: Star Strider 2019 年 2 月 28 日
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 Center および File ExchangeConway's Game of Life についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by