Typesetting of block allocations in pseudo-code

I am currently writing pseudo code from a matlab code into a latex document. I a m using the algorithm2e package.

I was wondering what was the best way to write down block allocations in a loop.

For instance, let B be a matrix and b a vector it is quite obvious to state something like

\For{i \gets 1 \KwTo I}{
\$B(i) \gets b\$
}

or

\For{i \gets 1 \KwTo I}{
\$B_{i} \gets b\$
}

But for a block allocation, say with a matrix b comprising m columns the matlab code would be

for i = 1:I
B(:,(i-1)*m+(1:m)) = b;
end

However, i do not see an obvious pseudo code, as I would prefer a more mathematical notation than the pure matlab :.

Do you have any proposition on how to typeset this properly ?

• I think this (old) question is hard to answer, in the end it's mostly a question of taste. I think the matlab syntax is easily understandable, you could even define in the text that B(:,i) = b means ... – anderstood Apr 19 '18 at 19:05
• @anderstood I agree, this is a question of taste. I was however interested in gathering other points of view. Unfortunately without luck... – BambOo Apr 19 '18 at 20:03
• Sorry, but primarily opinion-based questions are out of the scope of the site. :-) – anderstood Apr 19 '18 at 20:24