フィルターのクリア

Display Error message limit of chars

1 回表示 (過去 30 日間)
nad yah
nad yah 2015 年 10 月 14 日
コメント済み: dpb 2016 年 3 月 9 日
Hi, I'm writing a long code in matlab 2015a using try and catch, And trying to load many files with using load path. I'm using the catch error message to display the error info very simple example:
try;
load('/path/path/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2222111.txt');
catch err;
disp(err)
end;
but when I looking at the command line it looks like this:
MException with properties:
identifier: 'MATLAB:load:couldNotReadFile'
message: 'Unable to read file '/path/path/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...'
cause: {0x1 cell}
stack: [1x1 struct]
Notice that in the message: field, Matlab doesn't give me the file full path, the path is too long and he gives me 3 points... And I cant find the file like this.. How can I change the limit of chars representation?
Thanks!!

回答 (1 件)

dpb
dpb 2015 年 10 月 14 日
You've misdiagnosed the problem. The issue isn't the internal message is too long, it's that you've displayed the MException object err instead of the error message in your catch block. Try something like
...
catch err;
disp(err.identifier)
disp(err.message)
end;
I'd also suggest at least mildly that if this is a real problem your directory nesting is too deep or you're using excessively long file/subdirectory naming conventions, or both...Used to be the Winders OS filelength limit was 255 chars iirc and the above is getting dangerously close methinks plus it's a terrible nuisance albeit I understand these have to have been machine-generated.
  4 件のコメント
Walter Roberson
Walter Roberson 2016 年 3 月 9 日
260 does include trailing null. 255 + one for drive letter + colon + slash + null
dpb
dpb 2016 年 3 月 9 日
Slow day, Walter???? :)
It still seems to me a peculiar number for a limit...not that it's of an import, just an oddity (to my thinking, anyways).

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

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by