0

我正在尝试让 Matlab 读取一个 .unv 文件(它似乎可以正常打开并被视为 .txt)并收集数据。文件第一部分的示例如下:

-1
   151
bricktest.unv

CUBIT version 14.0 revised 2013-06-01 09:06:37 -0600 (Sat, 01 Jun 2013)
  03-07-13  14:14:00         0         0         0
  03-07-13  14:14:00
CUBIT
  03-07-13  14:14:00
    -1
    -1
   164
        10mm (newton)                  2
  1.00000000000000000D+03  1.00000000000000000D+00  1.00000000000000000D+00
  2.73149999999999960D+02
    -1
    -1
  1716

======================================================================
MATERIAL
======================================================================



    100  Default-Steel
         0  LINE(S) OF TEXT
         0  MATERIAL CLASS(ES):
         0  MATERIAL ATTRIBUTE(S)
         0  MATERIAL COMPONENT(S)
         0  MATERIAL SPECIFICATION(S)
----------------------------------------------------------------------
         0  MATERIAL VARIABLE(S)
----------------------------------------------------------------------
         4  MATERIAL PROPERT(IES)
----------------------------------------------------------------------
MODULUS OF ELASTICITY
         1  VERSION NUMBER
         0  LINE(S) OF TEXT
DIMENSIONS AND UNITS:
PRESSURE                                NEWTON/MILLIMETER^2
CONSTANT
  2.0680000000000000e+005
----------------------------------------------------------------------
POISSONS RATIO
         1  VERSION NUMBER
         0  LINE(S) OF TEXT
DIMENSIONS AND UNITS:
DIMENSIONLESS                           UNITLESS
CONSTANT
  2.8999999999999998e-001
----------------------------------------------------------------------
SHEAR MODULUS
         1  VERSION NUMBER
         0  LINE(S) OF TEXT
DIMENSIONS AND UNITS:
PRESSURE                                NEWTON/MILLIMETER^2
CONSTANT
  8.0155039000000004e+004
----------------------------------------------------------------------
MASS DENSITY
         1  VERSION NUMBER
         0  LINE(S) OF TEXT
DIMENSIONS AND UNITS:
MASS DENSITY                            GRAM/MILLIMETER^3
CONSTANT
  6.9999999999999999e-006
----------------------------------------------------------------------
DEFAULT MATERIAL PROPERT(IES):
MODULUS OF ELASTICITY                   VERSION :          1
POISSONS RATIO                          VERSION :          1
MASS DENSITY                            VERSION :          1
SHEAR MODULUS                           VERSION :          1
----------------------------------------------------------------------
         1  REFERENCE ENTITIES
         1  MATERIAL TYPES
FEM                                     ISOTROPIC MATERIALS
======================================================================
    -1
    -1
  2470

在这一点上,前 11 行对我来说并不是很相关。我已经将此输出解码到我知道“1716”表示材料属性定义的开始的地步。在这个文件中只有一种材料,但在其他文件中可能有一大堆,每个都以“1716”开头。

我希望此时能够忽略前 11 行,然后让 Matlab 存储材料属性数据,但由于我不知道将存在多少材料,我需要识别值“1716”,如果看来,阅读新材料。

最后的数字“2420”也表示不同类型的数据集(长度未知),所以最终我只想在文档中搜索这些标记并将数据保存在基于它们的数组等中。

我玩过 textscan 但遇到了麻烦......想法?

4

0 回答 0