Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How do I apply a function 360 times to a number of rows of data using a loop (or other method)?
1 回表示 (過去 30 日間)
古いコメントを表示
I have an excel sheet with columns of (1) latitude, (2) longitude, (3) range (m), (4) depth (m) and (5) transect number (1:360). Each transect has 1016 rows. I wish to apply a function (weston_function below) to all rows of each transect (starting with 1 and finishing with 360). It would be useful for the function to also output the transect number for each row as well as the values for R, H, Transmission Loss (TL) at each row.
Currently I have this as my code but I am aware this does not work...
if true
% Input xlsx file for data
data = xlsread('Outputs_360Transects_20180627.xlsx',1);
% Input data required by function
R = data(:, 3); % Range (m)
H = data(:,4); % Depth (m)
T = 15.; % Temperature
S = 37.; % Salinity
c_sed = 1800;
rho_sed = 2.0;
attn = 0.6;
freq_Hz = 10000.;
% Run function 360 times
n = 1:360;
for i = 1:n
[R,H,TL, Transect] = weston_function(R, H, T, S, c_sed, rho_sed, attn, freq_Hz);
end
3 件のコメント
Guillaume
2018 年 6 月 27 日
How does the weston_function know what Transect number to return? Is that function actually written yet? If it is already written can you show its code?
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!