How do you use the NaN function?
1 次查看(过去 30 天)
显示 更早的评论
How would write a code that for a vector that is 500 data points long, but the first 123 data points are NaN?
0 个评论
回答(1 个)
Abdolkarim Mohammadi
2020-9-14
编辑:Abdolkarim Mohammadi
2020-9-14
You first create the NaN vector using nan(), then fill in the elements.
V = nan (500,1);
V (124:end) = Data;
4 个评论
Abdolkarim Mohammadi
2020-9-14
No. If you have your vector of values for 125 to 500 and you want to transfer them to the new vector, then you should use:
V = nan (500,1);
V (124:end) = Data;
Otherwise, if you have a 500 element vector and you want to eliminate the first 125 elements, then you can do it in one command (not the one you mentinoed):
Data (1:123) = NaN;
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!