[Scilab-users] Shift indices
Samuel Gougeon
sgougeon at free.fr
Thu Nov 9 12:05:39 CET 2017
Le 08/11/2017 à 15:07, Richard llom a écrit :
> Hello,
> is there a function available to shift indices?
> E.g. I have
> aa = [1:10]
> and want
> bb = 6. 7. 8. 9. 10. 1. 2. 3. 4. 5.
>
> This is what I come up with:
> log_data2 = zeros(log_data);
> log_data2 = log_data(4001:size(log_data,1),:);
> log_data2((size(log_data,1)-4000+1):size(log_data,1),:) =
> log_data(1:4000,:);
>
> But I'm wondering if there is a prettier solution?
n = size(log_data,1);
log_data = log_data(modulo((1:n)-2+4001, n)+1, :);
Samuel
More information about the users
mailing list