📄 structexmple.m
字号:
%%%struct01.m
clear student %清除student变数
student.name='洪鹏翔';%加入 name 字段
student.id = 'mr871912'; % 加入 id 字段
student.scores =[58, 75, 62]; % 加入 scores 字段
student % 秀出结果
%%%struct02
clear student % 清除 student 变数
student.name = '洪鹏翔'; % 加入 name 字段
student.id = 'mr871912'; % 加入 id 字段
student.scores = [58, 75, 62]; % 加入 scores 字段
% 以下是新加入的第二笔数据
student(2).name = '邱中人';
student(2).id = 'mr872510';
student(2).scores = [25, 36, 92];
student %秀出结果
student(1)
student(2)
%%%%范例3 : struct03.m
student = struct('name', {'张庭硕', '张庭安'}, 'scores', {[50 60], [60 70]});
student(1) % 显示 student(1)
student(2) % 显示 student(2)
%%% 范例4 : struct04.m
student = struct('name', '张庭安','scores', {[50 60], [90 100]});
student(1) % 显示 student(1)
student(2) % 显示 student(2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -