在错误消息中显示行号 [英] Show Line Number in Error Message

查看:91
本文介绍了在错误消息中显示行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我使用的大多数MATLAB实例上,每当我的代码中有错误时,命令窗口中的错误消息就会显示行号.

On most instances of MATLAB I've used, whenever I had a bug in my code the error message in the command window would show the line number.

但是,在我当前使用的计算机上,它仅显示以下内容:

However on the computer I am currently using, it shows me only the following:

??? Subscripted assignment dimension mismatch.

反正还有行号而不是????再次显示吗?

Is there anyway to get the line number to show again instead of ?????

推荐答案

您正在做的是使用@cnzar所说的Run SectionRun and Advance.如果您像这样运行脚本,则没有行号",就像您在命令行窗口中复制粘贴代码并在其中运行代码时一样,该行不会显示错误的行号.

What you are doing is using Run Section or Run and Advance as @canzar said. If you run scripts like this there is no 'line number', just as when you copy-paste code and run it in the command-window will not show you the line number on the error.

如果使用run或按F5键运行脚本,则不知道行号,然后将其打印在错误语句中.调试时要知道的是,在出现错误时转到选项卡编辑器->断点-> dbstop.如果按下该按钮,它将在内存出现时使变量保持显示状态,而不是在调试函数时将所有内容都扔掉.

If you run the script using run or by pressing F5 it does know the line number and then prints that on the error statement. Good to know for debugging is to go to the tab editor->breakpoints->dbstop on error. If you press that it will keep your variables as present when the memory occurs, as opposed to throwing everything out when debugging functions.

这篇关于在错误消息中显示行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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