Compact MATLAB matrix indexing notation -
I have an en-by-size matrix, which has the Kashmir numbers per line. I want to use these K-numbers as an index in a one-dimensional matrix. Is there a compact way to do this in MATLAB or should I use the loop?
I want to do this (in MATLAB proxy code), but in more MATLAB-ish mode:
line = 1: 1: n last tab (= quenematic) = kemannatic Matrix (IndexMatics (line, 1) ... ... indexmatics (line, 2), ..., indexmatics (line, k) end
If you want to avoid using the loop, then this is probably the most obvious way to do this:
index = 2 points (index, 1); Linear index matrix = all 2 ind (dimensional matrix of size), indexxl {:}); FinalTable = Chememental Matrix (Linearindexmatics); of columns as one, in the linear index in the subscript index (row, column, Etc.) (Each matrix element is counting from 1 to n, the total number of elements in the n matrix). The last line uses these linear indices to change their copy for the loop. A good discussion can be found about matrix indexing (subscript, linear, and logical). Something else to think about ...
Vector is shy away from the loops in favor of solutions, whatever MATLAB users (including me) However, the new versions of MATLAB are looping more efficiently as if discussed in another SO question, using the loops can sometimes be a fast-moving code, as you have vectored Receive with the solution.
I'm not saying that you should not try to alert your code. Now, only every problem is unique. Vectorizing often will be more efficient, but always No. For your problem, the speed of execution of Loops vs. VectorCid code depends on how big the value is n and k .
Comments
Post a Comment