Can *these loops* be vectorized?
Mostrar comentarios más antiguos
I tried to vectorize any of these loops, but I couldn't do it. Strangely, when I try it out 'step-by-step' in the Matlab console, it works, but when changing it in my program (which can be found here) it doesn't work properly anymore.
Can anyone help me vectorize it OR make it otherwise faster? Thank you!
Info:
1. r is either 2,3 or 4
2. valuesBitwiseLonger is a binary number 132bits long
for u = 1 : r
ExOr1 = valuesBitwiseLonger(u);
ExOr2 = str2num(valuesBitwiseLonger(u + r));
exOrNew(u) = bitxor(str2num(ExOr1), ExOr2);
end
for l = 2*r : 132 - r + 1
NewExOr = '';
for p = 1 : r
NewExOr = horzcat(NewExOr, num2str(exOrNew(p)));
end
for u = 1 : r
ExOr1 = valuesBitwiseLonger(l + u - 1);
ExOr2 = str2num(NewExOr(u));
exOrNew(u) = bitxor(str2num(ExOr1), ExOr2);
end
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!