How to do a Loop statement from cell to double?
显示 更早的评论
Hi there
I have a file with wind information (direction and speed), the wind direction has this format (E, N, NE,...) I would like to do a wind rose from 1989 to 2019, so I have a file.xls with multiple sheets (from 1989 to 2019). I'm trying to convert the wind direction from (E, N, NE to 90, 0 , 45). But I do not know how to do it, any help? I post the file (1989.xlsx) and what I've been doing.
%% I created a artificial data to organized wind speed and direction
t1 = datetime(1989,01,01,00,00,00);
t2 = datetime(2019,12,31,23,00,00);
t = (t1:hours(1):t2)';
% my idea is to convert ('E', 'N'... to 90, 0) to the 30 years.
for i = length(1989.VarName1(10:40))
if 1989.Dir{10:40},'E' == 1;
1989.Dir(10:40)= 90;
end
end
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!