So, I've got some clue. Because this code is inside C# code, it is indented. That leads to problems with for cycle. I didn't fixed it yet, but I suspect, that the problem is the result of specific use of curly brackets and indentation. Anyway, when I replace for cycle with direct assigments of values to created matrix, it works fine and I get a proper matrix as return.
↧