Skip to content

Commit ed97ac0

Browse files
CHG: syntax highlight
1 parent 7137820 commit ed97ac0

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

docs/getting-started/model-class.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ nav_order: 2
77

88
# Model Class
99
All the data belonging to a model (geometry, node coordinates, results, etc.) is held in the same object `model`. To create a new model in MATLAB, run,
10-
````
11-
md = model
12-
````
10+
```m
11+
md = model()
12+
```
1313
and in Python,
14-
````
14+
```py
1515
from model import *
1616
md = model()
17-
````
17+
```
1818
This will create a new model named `md` whose class is `model`. The information contained in the model `md` is grouped by class, each of which are comprised of fields related to that particular aspect of the model (e.g. mesh, material properties, friction, stressbalance solution, solution results). When one creates a new model, all of these fields are empty or `NaN` (not a number), but `md` is ready to be used as a model. The list of these classes is displayed by running, in MATLAB,
1919

20-
````
20+
```m
2121
>> md
2222
md =
2323
@@ -28,9 +28,9 @@ md =
2828
results: [1x1 struct] -- model results
2929
radaroverlay: [1x1 radaroverlay] -- radar image for plot overlay
3030
miscellaneous: [1x1 miscellaneous] -- miscellaneous fields
31-
````
31+
```
3232
or, in Python,
33-
````
33+
```py
3434
>>> print(md)
3535
mesh: [1x1 mesh2d] -- mesh properties
3636
mask: [1x1 mask] -- defines grounded and floating elements
@@ -39,25 +39,24 @@ or, in Python,
3939
radaroverlay: [1x1 radaroverlay] -- radar image for plot overlay
4040
miscellaneous: [1x1 miscellaneous] -- miscellaneous fields
4141
stochasticforcing: [1x1 stochasticforcing] -- stochasticity applied to model forcings
42-
````
42+
```
4343

4444
Likewise, you can display all the fields associated with, for example, the model's mesh by running,
45-
````
45+
```m
4646
>> md.mesh
4747
````
4848
or,
49-
````
49+
```py
5050
>>> print(md.mesh)
51-
````
51+
```
5252

5353
## Saving/Loading a Model
5454
You can save the model with all its fields so that the saved file contains all of the information in the model by running,
55-
````
55+
```m
5656
save squaremodel md
57-
````
57+
```
5858
This will create a file `squaremodel.mat` made from the model `md`. Likewise, to load this file, run,
59-
````
59+
```m
6060
>> loadmodel squaremodel
61-
````
61+
```
6262
The loaded model will be named `md`.
63-

0 commit comments

Comments
 (0)