circshift function speed up

9 views (last 30 days)
agg gpo
agg gpo on 27 Jan 2016
Edited: dpb on 27 Jan 2016
Hello, I'm trying to optimize my code. I'm using circshift function in my code. I was wondering whether there is a way to speed up the loop which is using circshift cause according to the profiler most of the time spent on running the code is spent by circshift. Either by changing the circshift or some other solutions. I have also tried to do normal indexing rather than using circshift but it's taking more time. Here is my code:
for i = 1:BitLength
d(i) = xor(initialState(2),initialState(1));
initialState = circshift(initialState,[0,1]);
initialState(1) = d(i);
end
I tried the following code but it didn't help:
for i = 1:BitLength
d(i) = xor(initialState(2),initialState(1));
initialState =initialState ([end 1:end-1]);
initialState(1) = d(i);
end
Thanks.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!