Error using the igrfmagn function (collecting the output)

2 ビュー (過去 30 日間)
Nikolaos Zafirakis
Nikolaos Zafirakis 2019 年 4 月 19 日
コメント済み: Nikolaos Zafirakis 2019 年 4 月 19 日
I can’t seem to collect the values produced by the function igrfmagm. The error produced says ‘Error using cell Too many output arguments’. Either by you using cell or zeros the output is the same. The first output is a vector and the rest scaler quantities. The inputs are all scalers. Thanks in advance to anyone who helps!
time = 100;
[mag_field_vector,hor_intensity,declinatioon,inclination,total_intensity]=cell(size(time));
for i=1:length(time)
[mag_field_vector,hor_intensity,declinatioon,inclination,total_intensity] ...
= igrfmagm(alt(i),lat(i),lon(i),T(i),12)
end

採用された回答

Walter Roberson
Walter Roberson 2019 年 4 月 19 日
time = 100;
[mag_field_vector, hor_intensity, declinatioon, inclination, total_intensity] = deal(cell(size(time)));
for i = 1:numel(time)
[mag_field_vector{i}, hor_intensity{i}, declinatioon{i}, inclination{i}, total_intensity{i}] ...
= igrfmagm(alt(i), lat(i), lon(i), T(i), 12)
end
It is not clear why you loop over the elements of time but time does not form an input to your calculation.
It is not obvious that alt, lat, lon, T will all have a number of elements equal to the number of elements in time
By the way, is there any particular reason you used declinatioon instead of declination ?
  1 件のコメント
Nikolaos Zafirakis
Nikolaos Zafirakis 2019 年 4 月 19 日
Thanks, it works perfectly. Time is T I just forgot to change the last one. Also changed the declination to declination thanks for spotting that out!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by