1.struct

  • 第一,通过“.”创建结构数组。在命令行窗口输入如下代码:

    student.name='Jason'; student.class='class 3';

    student.results={'English','Maths';85,95};

    student.system=[1,2,3;4,5,6;7,8,9];

    然后输入student,按回车查看创建的结构数组student,返回如下结果:

    student = 

    name: 'Jason'

    class: 'class 3'

    results: {2x2 cell}

    system: [3x3 double]

    同时看到工作区出现名称为student,值为1*1的结构数组。

    Matlab中一些函数的用法

  • 第二,通过struct函数创建结构数组。在命令行窗口输入clear all; clc按回车,清空命令行窗口,然后输入如下代码:

    student=struct('name','Jason','class','class 3','results',{'English','Maths';85,95},'system',[1,2,3;4,5,6;7,8,9]);

    然后输入student,按回车查看创建的结构数组student,返回如下结果:

    student = 

    2x2 struct array with fields:

    name

    class

    results

    system

    同时看到工作区出现名称为student,值为2*2的结构数组。

    Matlab中一些函数的用法



相关文章:

  • 2021-12-22
  • 2021-04-27
  • 2021-06-09
  • 2021-12-05
  • 2021-12-17
  • 2022-02-01
  • 2022-02-03
猜你喜欢
  • 2021-04-15
  • 2022-01-10
  • 2021-12-19
  • 2021-11-19
  • 2021-11-19
  • 2021-11-19
  • 2021-08-05
相关资源
相似解决方案