Marc-Olivier - the line of code
will create a 1x3 cell array of two numbers (in the first and third positions) and a string (for the operation). It is not a string.
If you have several operations/equations, then you can concatenate them together to form the history as
history = [];
for k=1:5
numA = randi(255,1,1);
numB = randi(255,1,1);
operator = '+';
eqn = {numA operator numB};
history = [history ; eqn];
end
If you wish to access the third equation in the history, you would then do
thirdEquation = history(3,:);
You are accessing the third row (so use 3) and you want all of the columns (so use the colon).
To print this equation, you would do
fprintf('%d %s %d\n', thirdEquation{1}, thirdEquation{2}, thirdEquation{3});
where you specify the type of each element in your equation: number, string, number.
You should then be able to manipulate any of the values in this third equation via the usual manner of accessing elements in the cell array.
Best Answer