给出matlab嵌套for循环输出数据
时间: 2023-11-11 07:09:10 浏览: 114
MATLAB——求解for嵌套循环
以下是一个嵌套的for循环输出数据的示例代码:
```
for i = 1:3
for j = 1:4
disp(['i = ' num2str(i) ', j = ' num2str(j)])
end
end
```
上述代码将会输出以下内容:
```
i = 1, j = 1
i = 1, j = 2
i = 1, j = 3
i = 1, j = 4
i = 2, j = 1
i = 2, j = 2
i = 2, j = 3
i = 2, j = 4
i = 3, j = 1
i = 3, j = 2
i = 3, j = 3
i = 3, j = 4
```
阅读全文