class_docstr: A setting that allows editing of a 2D matrix of binary values
      
docstr: Convert a matrix to a pickled form
  
  format is <row-count>,<column-count>,<0 or 1>*row-count*column-count
  
  e.g., [[True, False, True], [True, True, True]] -> "2,3,101111"
docstr_tok: ["Convert","a","matrix","to","a","pickled","form","format","is","<","row-count",">",",","<","column-count",">",",","<","0","or","1",">","*","row-count","*","column-count","e.g.",",","[","[","True",",","False",",","True","]",",","[","True",",","True",",","True","]","]","-",">","``","2,3,101111","''"]
code: def to_value(matrix):
      """Convert a matrix to a pickled form
  
      format is <row-count>,<column-count>,<0 or 1>*row-count*column-count
  
      e.g., [[True, False, True], [True, True, True]] -> "2,3,101111"
      """
      h = len(matrix)
      w = 0 if h == 0 else len(matrix[0])
      return ",".join(
          (
              str(h),
              str(w),
              "".join(
                  [
                      "".join(["1" if v else "0" for v in row])
                      for row in matrix
                  ]
              ),
          )
      )
  
imports: from ._setting import Setting
label_desc: Use image node_id 2 for calling the BinaryMatrix obj's underlying member method code with example usage: obj.to_value(matrix) and returns: str