save a vector in an array

2 次查看(过去 30 天)
Rica
Rica 2012-11-6
Hi! I have this loop and i want to save the index (ind) in a vector or array. How should i do this
i thougt about a=[a;ind], but it was not true.
%code
for l=1:length(date_time_l)
[~, ind] = min(abs(numdates-(date_time_l(l))));
end
%end of code
i thougt about a=[a;ind], but it was not true.
thank you

采纳的回答

Thomas
Thomas 2012-11-6
try
for ii =1:length(date_time_l)
[~, ind(ii)] = min(abs(numdates-(date_time_l(ii))));
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Text Data Preparation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by