[Scilab-users] Shift indices

Rafael Guerra jrafaelbguerra at hotmail.com
Thu Nov 9 12:42:55 CET 2017


n = size(log_data,1);
log_data = log_data([4001:n,1:4000], :);

Rafael

-----Original Message-----
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Samuel Gougeon
Sent: Thursday, November 09, 2017 12:06 PM
To: Users mailing list for Scilab <users at lists.scilab.org>
Subject: Re: [Scilab-users] Shift indices

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
_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



More information about the users mailing list