Cell Array Syntax

Two questions:

1) I found a piece of code that says something like cellArr{x}{y}{3,8} = 1.0;, I was wondering what it means {3,8}. The program connects the various nodes in sets of related graphs together. Here we could say that "in the set of graphs x, graph y, a connection from 3 to 8 has a vertex vertex of 1.0". However, in general, what does the syntax {3,8}in MatLab mean ?

2) This is probably not the place for this question, but if I really use cell arrays, if I know that I will always have vertex values, i.e. decimal numbers / floats. Will the matrix be better because I know that I will have only one data type?

Thank:).

+3
source share
2 answers
  • , , . {3,8} - () , .

  • : . , x y , cellArr - , x, , , y, .

    , (.. []) , 2- D, :

    cellArr{x}{y}(3,8) = 1.0;  %# Note the use of () instead of {}
    

    , , x y. , y, 2-D , , :

    cellArr{x}(3,8,y) = 1.0;  %# Here I've chosen to use y as the third dimension
    

    , , x, 3-D , , cellArr 4-D , :

    numArr(3,8,y,x) = 1.0;
    

    (.. numArr) , x y , , , numArr(:,:,y,x) 2- . , numArr(x,y,:,:), 4-D ( , , SQUEEZE).

+4
  • {3,8} - , {x} {y}. , cellArr . {x}. 2d- , {y}. , {3,8}, 8- .
  • , 4- . numericArray[x, y, 3, 8].
+4

Source: https://habr.com/ru/post/1794516/


All Articles