I am receiving an error addressing tables in debug mode

This may be an error in the MATLAB source code, but I'm having issues with addressing tables when debugging code. This is happening consistently.
For example, tables receive an error: "Index exceeds matrix dimensions." whenever I try to access data using: indices, column names as string, or anything. It will work sometimes after I quit the debugging and re-run the code.
What's going on? Why am I having such an issue addressing tables? Is this a software bug
Here's an example of what causes a problem:
% Generic Code: Make a table
X = table((1:26)', cellstr(char(65:65+25)'),'VariableNames', {'Numbers', 'Letters'});
row1col2 = X(1,2); %addressing the first row, second column creates an error: Index exceeds matrix dimensions

回答 (2 件)

Peter Perkins
Peter Perkins 2017 年 2 月 9 日

0 投票

In the debugger, when stopped in a method of a class, you are in effect "inside" the table, and none of the overloaded subscripting is called. table has overloaded subscripting, which is why you're seeing this, but the general idea is not specific to table. It's how the debugger interacts with the object system, and is what's needed to be able to debug a class's protected/private code.
You can call subsref directly, though.
Shio Williams
Shio Williams 2017 年 2 月 12 日

0 投票

Hi Peter,
Thank you for the reply. I am not debugging from within the subsref function. I am debugging from within the code of a GUI, so technically my workspace should be similar to that of the Base with a few exceptions. Does that answer still apply?

1 件のコメント

Peter Perkins
Peter Perkins 2017 年 2 月 13 日
It seems like you might have an unusual situation that is best handled by contacting MathWorks support directly.

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

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

質問済み:

2017 年 2 月 9 日

コメント済み:

2017 年 2 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by