您最喜欢的MATLAB/Octave编程技巧是什么? [英] What is your favourite MATLAB/Octave programming trick?

查看:76
本文介绍了您最喜欢的MATLAB/Octave编程技巧是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想每个人都会同意MATLAB语言不是很漂亮,或者特别是一致.但是没关系!我们仍然必须使用它来完成任务.

I think everyone would agree that the MATLAB language is not pretty, or particularly consistent. But nevermind! We still have to use it to get things done.

您最喜欢的使事情变得容易的窍门是什么?让我们为每个答案提供一个答案,以便人们在同意的情况下可以将其投票.另外,尝试通过示例来说明您的答案.

What are your favourite tricks for making things easier? Let's have one per answer so people can vote them up if they agree. Also, try to illustrate your answer with an example.

推荐答案

使用内置的探查器查看我的代码最重要的部分在哪里:

Using the built-in profiler to see where the hot parts of my code are:

profile on
% some lines of code
profile off
profile viewer

或仅使用内置的tictoc来获取快速计时:

or just using the built in tic and toc to get quick timings:

tic;
% some lines of code
toc;

这篇关于您最喜欢的MATLAB/Octave编程技巧是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆