Help understanding the erorr in a matlab code
1 次查看(过去 30 天)
显示 更早的评论
I'm writing a function which recives a matrix of birth and death dates and return the number of days between them.
function daysVector=dateDiffMatrix(dateMat)
p=zeros(size(datMat,1),1);
for i=1:size(dateMat,1)
p(i)=dateDiff(dateMat(i,1:3),dateMat(i,4:6));
end
daysVector = p;
end
when I run it on the command window I received this message: Error in dateDiffMatrix (line 2) p=zeros(size(datMat,1),1);
Can you help me understand what is wrong with the code? thank you very much.
2 个评论
Jan
2013-3-25
Please use meaningful tags. All questions in a Matlab forum concern "matlab", and almost all concern "matlab code". Thanks.
回答(1 个)
Ilham Hardy
2013-3-25
Hi,
datMat is suppossed to be dateMat
2 个评论
Image Analyst
2013-3-25
Please mark the answer that best answers your questions as "Accepted." Do so for all your other questions too.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!