I need to code a1, a2, a3 = 0. any idea how to do this? I've read about deal, but it seems too long to code 19-20 "a" variables.

1 回表示 (過去 30 日間)
migs
migs 2017 年 4 月 24 日
編集済み: Stephen23 2019 年 6 月 25 日
I've read about deal, but it seems too long to code 19-20 "a" variables.
The follow-up question would be, I need to input the blade section data from Excel to Matlab. For instance, r1 = 1.27, r2= 1.35 where r is the radius. I have to deal with 19 elements so the data will go up to r19= 5. any tips on how to do this? :)
Kind regards, Wesley
  2 件のコメント

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

回答 (2 件)

Jan
Jan 2017 年 4 月 24 日
編集済み: Jan 2017 年 4 月 24 日
Use a vector instead:
a = zeros(1, 19);
Now your "a1" is a(1).
It is not clear what "input the blade section data from Excel to Matlab" exactly means. I assume an xlsread or tableread might solve the problem.
  2 件のコメント
migs
migs 2017 年 4 月 24 日
sir, if a gets into the loop, would the said code still applies?

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


Greg Dionne
Greg Dionne 2017 年 4 月 24 日
How about putting them into a vector?
% put them into a vector
r = [1.27 1.35 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 5];
% Access your variables via indexing like Stephen's suggestion.
r(1)
r(19)
  2 件のコメント
migs
migs 2017 年 4 月 24 日
I see! thanks! would you encourage the said code you've given than have it access via excel? aside from the radius, there are other variables as well like chord length (x), twist angle (x) ; where x= 1,2,...19.
Greg Dionne
Greg Dionne 2017 年 4 月 25 日
It depends on where you want to do the bulk of the work (MATLAB or Excel). Excel has ranges (e.g. B1:B8) and you can do basic math on that. MATLAB has ways of importing data from a saved Excel workbook (see for example, xlsread and xlsinfo). Once you have it in MATLAB though, it's generally easy to work with. Good luck.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by