Matlab warning points to the wrong line

4 ビュー (過去 30 日間)
Alexandru
Alexandru 2014 年 10 月 29 日
コメント済み: Alexandru 2014 年 10 月 29 日
Hello,
I am executing an m-file using Matlab 2014b. Let's call it my_m_file. During the execution I am getting the following warning:
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.277288e-17. > In viaMtimes at 35 In my_m_file at 35
I understand the warning and at line 35 in the file viaMtimes one has: "Z = inv(Z);". It is true that at several points in my code I am raising a matrix to the power -1 and I understand that on one such occasion the matrix is close to singular so the inversion is problematic.
Normally the last part of the message "In my_m_file at 35" would point out to the line in my m file where the problem lies. But this is where it gets strange. On line 35 of the file I am actually declaring a new variable as M = NaN(T,N) where T and N have been previously defined. What causes Matlab to point to the wrong line and how can I fix this?
Thanks,
Alex

回答 (2 件)

Andreas Goser
Andreas Goser 2014 年 10 月 29 日
I can think of an effect where you have multiple files with the same name on the path like previous versions or a pcoded file. You can test this with
which my_m_file -all
I also wonder if the effect is reproducible on other machines/installations?
  1 件のコメント
Alexandru
Alexandru 2014 年 10 月 29 日
I tested for the same name on the path using your command and it produced a single output: the path to the current file. I also tried renaming the file, but that didn't work either.
I will see to what extent I can run the code on a different machine.

サインインしてコメントする。


Robert Cumming
Robert Cumming 2014 年 10 月 29 日
This could also happen if your file is locked by mlock. If you restart Matlab does the problem remain?
  1 件のコメント
Alexandru
Alexandru 2014 年 10 月 29 日
I tried a restart both of Matlab and the computer. That didn't fix it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by