(This is a text file with LaTeX mark-up.) I keep getting this error in Octave (though it should also show up in MATLAB). \begin{verbatim} error: =: nonconformant arguments (op1 is 1x14, op2 is 1x15) \end{verbatim} I'm trying to build a text-representation of 2D array. The 2D array is a bit complicated, in that each element is a subset of an image, and the image uses the same few tiles over and over. I want a program to read in the image, then write out the tiles, like 'w....w' for a line indicating a wall, 4 floor spaces, and another wall. The problem does not really stem from the image, but is a problem with the assignment of a string to a 2D array called \verb"myroom". Putting in some debugging code, I found that variable \verb"rowCount" is 8. This means that \verb"myroom" is almost complete, and that the problem shows up on the last line. That is, it set \verb"myroom(7,:) = walls;" just fine, but setting \verb"myroom(8,:) = walls;" causes the error. Here is some debug code output. \begin{verbatim} walls is "e111111111111e". default_line is "ZZZZZZ::ZZZZZZ". myroom(rowCount-1,:) is "e111111111111e". \end{verbatim} The strings appear to be the exact same lengths. I added some more debugging code, which generated the following output: \begin{verbatim} len myroom(rc-1,:) is 14, while len walls is 15 walls 0 90 90 90 90 90 90 58 58 90 90 90 90 90 90 default_line 0 90 90 90 90 90 90 58 58 90 90 90 90 90 90 myroom(rc-1,:) 101 49 49 49 49 49 49 49 49 49 49 49 49 101 \end{verbatim} The ASCII representations look fine at first, until I noticed that the leading value is 0. That should not be there. Once I saw the leading 0, the fix became obvious. Going back to the code, there is an index range of \verb"0:MAX_TILE_COL-1" that is used to iterate over the tiles. However, starting the index at 0 causes a problem in MATLAB/Octave, so the index has \verb"+1", i.e. there is a line with a statement like \verb"default_line(tile_col+1) = ..." Another issue is that the tiles should be surrounded by walls on all sides, so there should be 2 more columns. While that is being done, we could shift the index such that it starts at one. Putting this together, we get this: \begin{verbatim} for tile_col = 1:length(0:MAX_TILE_COL-1) + 2 % ... more stuff ... default_line(tile_col+1) = 'Z'; % ... more stuff ... end \end{verbatim} Thus, \verb"default_line(1)" is not assigned a value by the code, and \verb"default_line" has a length with one more element than it should. The 0 characters do not show up when \verb"disp" outputs the lines to the command window. Thus, the strings look to be the correct size, but are not. The fix is simple: replace \verb"tile_col+1" with \verb"tile_col". This illustrates a problem that takes a lot of time to understand exactly what is going on, but only seconds to fix. -Michael Weeks, 2023