how can i change a particular range of data
28 次查看(过去 30 天)
显示 更早的评论
I want to change 3 ranges of data. lets say i have a array that contains 10000 elements and i want to chage the 1st to 599th,600th to 1000th and 1001st to 10000th elements in an array. how can i achieve it.
thanks
PV =[112648;119180;.......117072;113687;114429;115560]
n=length(PV);
while n=(600:1000);
PV = 165000+zeros(1,401);
end
while n=(1:599);
PV=125000+zeros(1,599);
end
while n=(1001:10000);
PV=200000+zeros(1,9000);
end
PV
0 个评论
回答(1 个)
Geoff Hayes
2019-7-5
Shikang - to access subsets of values in your array, you could do
PV = zeros(10000,1);
PV(1:599) = 125000;
PV(600:1000) = 165000;
PV(1001:end) = 200000;
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!