# midas_io_matlab **Repository Path**: bjut804/midas_io_matlab ## Basic Information - **Project Name**: midas_io_matlab - **Description**: ======================== - **Primary Language**: Unknown - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-07 - **Last Updated**: 2024-04-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mgt文件matlab接口 ## 概要 + midas测试版本 : 2022 v2.1 (9.3.0) + matlab测试版本 : 2023a, 采用的dictionary数据结构在2021b引入, 因此之前的版本不支持 + matlab查询数据结构 : dictionary 查询模式 : { } (花括号) + matlab根数据结构 : cell + 提取数据以.get_{NAME}_dict对象方法, 返回 : dictionary 或 mat 对象 ## 使用范例 ### 示例代码 : ```matlab clc;clear;format long; % 清理和基本数据精度设置 import matlabio.* % 将+matlabio包含入脚本文件夹后,采用import引入 fp = 'E:\work\work2023\20231117萨尔瓦多体育场\模型20231121.mgt'; % mgt路径变量 rd = mgt_reader(fp); % 读取对象初始化, 尽量采用带参数初始化, 必要步骤 rd.read_raw(); % 读缓存,必要步骤 nodearr = rd.get_node_arr(); % 读取节点数据,返回矩阵,格式为[[node_idx, x, y, z],......] nodedict = rd.get_node_dict(); % 读取节点数据,返回dictionary,格式为nodedict{nodeid} = [x, y, z] elemdict = rd.get_elem_dict(); % 读取单元,返回dictionary,格式为elemdict{id} = {...} topo = rd.get_elem_topo_dict(); % 读取拓扑,返回dictionary,格式为attrdict{id} = {i, j, k,.....} attr = rd.get_elem_attr_dict(); % 读取属性,返回dictionary,格式为attrdict{id} = {imat, tsec} mat = rd.get_mat_dict(); % 读取材料属性,返回dictionary,格式为mat{id} = dictionary{ % "idx", "type", "name", "ex", "ey", "ez", % "prxy", "pryz", "prxz", "gxy", "gyz", "gxz", % "alpx", "alpy", "alpz", "dens", "dmpr"} sec = rd.get_section_dict(); % 读取截面属性,返回dictionary,格式为sec{id} = dictionary{ % "idx", "type", "name", "secType", "secInfoList"} seca = rd.get_section_area_dict(); % 读取截面面积属性,返回dictionary,格式为seca{id} = area thk = rd.get_thickness_dict(); % 读取厚度属性,返回dictionary,格式为thkt{id} = { % "idx", "type", "infoList"} cons = rd.get_constraint_dict(); % 读取约束,返回dictionary,格式为cons{id} = { % "idx", "group", "x", "y", "z", % "rx", "ry", "rz", "warp"} grp = rd.get_group_dict(); % 读取约束,返回dictionary,格式为grp{id} = dictionary( % "node_list" : [] % "element_list" : [] % "plane_type" : [] % ) % ```