Error: ()-indexing must appear last in an index expression.

1 回表示 (過去 30 日間)
shane watson
shane watson 2020 年 2 月 19 日
コメント済み: shane watson 2020 年 2 月 19 日
Hello,
I got this error, here is my code, can you help me out.
for info: Uns_states is the matrix whose 1st row I'm using so I will only show first row for the sake of simplicity Uns_states=[1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 ]
app= containers.Map({ 'Name', 'Power', 'cyclic', 'E_curr', 'E_max', 'E_min','loss_idle','loss_use','type_of_app','states', 'time'},...
{'app', 0.075, false, 0, 0.075,0,0,0, 'none',Uns_states(1,:),14});
Now I want to call the element of Uns_states one by one. That is how I'm doing that app('states')(1,3). Can someone guide me how to do that.
Thanks in advance.

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 2 月 19 日
You need to use a temporary variable, or you need to use a helper function, or you need to use the subsref function (which has an exceptionally ugly calling sequence)
  1 件のコメント
shane watson
shane watson 2020 年 2 月 19 日
@Walter, can you guide me how to use temporary variable or subsref function in this regard

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by