Subscripted assignment dimension mismatch.

1 回表示 (過去 30 日間)
Dhipikaa Sri Dhamotharan
Dhipikaa Sri Dhamotharan 2015 年 9 月 30 日
編集済み: James Tursa 2015 年 10 月 1 日
for i=1:i
var(1,i) = find(m1==indexes(1,i));
end
error is var(1,i) = find(m1==indexes(1,i));

採用された回答

James Tursa
James Tursa 2015 年 9 月 30 日
The result of the find is likely a vector, and it appears you are trying to stuff this vector into a scalar spot. Do you need all of the find results, or maybe just one of them? If you need all of them, can you use a cell array for var? What is var being used for downstream in your code?
  3 件のコメント
Dhipikaa Sri Dhamotharan
Dhipikaa Sri Dhamotharan 2015 年 9 月 30 日
can u plz explain me with syntax...kindly help me with syntax to change
James Tursa
James Tursa 2015 年 10 月 1 日
編集済み: James Tursa 2015 年 10 月 1 日
Not knowing what how var is going to be used downstream, I am just going to make a guess as to what might work for you with a cell array. Note that I changed your upper loop index to n ... it didn't make sense for the loop indexing to be i=1:i
n = whatever
var = cell(1,n);
for i=1:n
var{i} = find(m1==indexes(1,i));
end
Downstream in your code, when you need to get at the results of the find you would use (note the use of the curly braces): var{i}

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

その他の回答 (0 件)

カテゴリ

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