Overwrite the same matrix passed into a function?
显示 更早的评论
Hi, I have a function that edits some dates in a column to serial dates. How can I overwrite the matrix I pass into the function? When I run for example:
(dateMatrix) ----> new dateMatrix
But what happens is I get the ans matrix returned.
function A = changeDates(A)
d = A(:,1);
d=num2str(d)-0;
Y=str2num(char(d(:,1:4)));
M=str2num(char(d(:,5:6)));
D=str2num(char(d(:,7:8)));
sd=datenum(Y,M,D)
A(:,1) = sd;
clear d Y M D sd
thanks friz
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!