Why do i get ""
显示 更早的评论
Hello! I am trying to do a function that basically does this:
getInterpolationArrays(2,8)
x = [1, 3, 5, 7]
xp = [2, 4, 6, 8]
getInterpolationArrays(5,8)
x = [1, 6]
xp = [2, 3, 4, 5, 7, 8]
The array xp is like a "complement" of x. I writed the function below, but i get the following warning: Variable xp appears to change size on every loop iteration. I dont know how to solve it. Thank you for the response!
function [x, xp] = getInterpolationArrays(days, size)
x = 1:days:size-1;
n = length(x);
xp = [];
for i=1:size
if(ismember(i,x) == 0)
xp = [xp, i];
end
end
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!