📄 testcell.m
字号:
%保存为testcell.m文件
function[]=testcell()
%function[]=testcell()
tcell=cell(2,3)
tcell{1,1}=[1 2 3;4 5 6;7 8 9;];
%...表示续行符号
tcell{1,2}=struct('name','李月',...
'college','北京科技大学',...
'phone','01063320501',...
'specialties',{'平面设计','网站制作'});
tcell{1,3}=[2+3*i 5+6*i;3+3*i 0.1+0.558*i;];
tempcell=cell(2,2);
tempcell{1,1}='string';
tempcell{1,2}=[2 4;6 8;];
tempcell{2,1}=[7 8 9];
tempcell{2,2}=32+i;
tcell{2,1}=tempcell;
tcell{2,2}='Hello World!';
tcell{2,3}=[9 8 6;5 4 3;2 1 7];
%采用"{"和"}"索引得到相应元组阵列元素
for i=1:2
for j=1:3
disp(tcell{i,j})
end
end
%通过"("和")"索引得到1*1的相应元组阵列
for i=1:2
for j=1:3
disp(tcell(i,j))
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -