在MATLAB中,可以在两行之间执行一个代码区域,从%%
开始使用Ctrl-Enter
。这样的区域称为代码单元,它允许快速的代码测试和调试。
如
%% This is the beginning of the 1st cell
a = 5;
%% This is the end of the 1st cell and beginning of the 2nd cell
% This is just a comment
b = 6;
%% This is the end of the 2nd cell
有没有支持类似功能的Python编辑器?
发布于 2018-02-07 09:31:37
Python IEP的交互式编辑器有一个Matlab单元格标记来标记代码段(通过用'##'开始一行),默认的快捷方式也是Ctrl+ Enter:
## Cell one
"""
A cell is everything between two commands starting with '##'
"""
a = 3
b = 4
print('The answer is ' + str(a+b))
## Cell two
print('Hello World')
https://stackoverflow.com/questions/-100007358
复制相似问题