フィルターのクリア

I can not create a matrix

3 ビュー (過去 30 日間)
Muhendisleksi
Muhendisleksi 2017 年 3 月 30 日
コメント済み: Muhendisleksi 2017 年 4 月 6 日
Z =[150.0276305609584
55.1225122601673
251.4164611561661
344.9623210277200
20.7924313051007
150.0276305609584
55.1225122601673
251.4164611561661
344.9623210277200
20.7924313051007]
YON_BLNM =[27
32
34
39
133]
BNdog =[34
133
32
27
133
39
39
133
27
32
133
34
27
34
39
32]
for i = 1:length(YON_BLNM)
Zi{i} = Z(BNdog==YON_BLNM(i),1);
end
I have to make 16 angles But I am having problems in the loop.

回答 (2 件)

Seyedali Mirjalili
Seyedali Mirjalili 2017 年 3 月 31 日
Please note that curly brace ({i}) makes a cell array and not a matrix. You have to use square brackets instead: []
So:
for i = 1:length(YON_BLNM)
Zi[i] = Z(BNdog==YON_BLNM(i),1);
end
  2 件のコメント
Muhendisleksi
Muhendisleksi 2017 年 3 月 31 日
"Error: File: dogrultu_kenar_hesabi.m Line: 302 Column: 7 Unbalanced or unexpected parenthesis or bracket."
This error occurs
Jan
Jan 2017 年 3 月 31 日
編集済み: Jan 2017 年 3 月 31 日
@Muhendisleksi: This is a typo, obviously. Use Zi(i) instead with round parenthesis. Square brackets are the concatenation operator, see http://www.mathworks.com/matlabcentral/answers/35676-why-not-use-square-brackets .

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


Andrei Bobrov
Andrei Bobrov 2017 年 3 月 31 日
Maybe so?
[~,ii] = ismember(BNdog,YON_BLNM)
Zi = Z(ii);
  2 件のコメント
Muhendisleksi
Muhendisleksi 2017 年 4 月 1 日
編集済み: Muhendisleksi 2017 年 4 月 1 日
"BNdog", "YON_BLNM", "ri" and "Z" are constantly changing. Do not we have a chance to write more dynamic?
Muhendisleksi
Muhendisleksi 2017 年 4 月 6 日
Is not that possible?

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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by