Hi, I have an issue creating string. let say I have 2 numbers and a string:
nb1 = 12;nb2 = 1;str1 = '+';
I want to create a variable (array or a string) from these 3 variables:
op = {nb1 str1 nb2} ;
op is an operation, (i will later need to acces nb2 as a number value and fprint the whole op.)
I then need to make an array of op. This array is storing every operations made.
history = [];for i = 1 : 5 history = [history op]; %adding the last operation in the history
nb1 = nb1 + i; %just changing the numbers in a random way to illustrate
nb2 = nb2 - i;
str1 will also change for an other string, I lack imagination to illustrate that…
op = {nb1 str1 nb2};end
i want to be able to access a certain operation in the history and fprintf it on the screen.
op = history (n*2);fprintf ('%s',op);
And finally, also change the value of a number from the previous value.
nb1 = op{1};
op and nb1 at this stage should be what they were "n" operation before.
Best Answer