write into a specific cell in matlab

To write into a specific cell in matlab, you can use indexing. Here's an example code snippet:

main.m
% create a matrix with cells
M = {1, 2, 3; 4, 5, 6};

% write into a specific cell
M{1, 2} = 9;
96 chars
6 lines

In this example, we create a matrix M with cells, and then write the value 9 into the cell in the first row, second column using indexing syntax ({1, 2}).

gistlibby LogSnag