hi I am new to matlab can you hep me guys Develop my code to show the present result, previous result and total number of result of the number of dots, I've already finish the image processing and show the result, my problem is to show my previous result, and total result. this is my code..
a = get(handles.pres,'String'); %present text string b = get(handles.prev,'String'); %previous text string c = get(handles.total,'String'); %total string
%THIS IS TO SHOW MY PRESENT RESULT set(handles.present,'String',Ndots); %this is to show the present result
%THIS IS TO SHOW MY TOTAL RESULT out = str2num(a) + 0 ; set(handles.total,'String',out); % total result only show by running the program how can I do it to make continues adding result? just like a calculator it stores the previous result i am right?
%THIS IS TO SHOW MY Previous result and i dont have any idea how I am going to pass the string of the present result to the previous string
any help would be appreciate thanks a lot..
No products are associated with this question.
You don't need a, b, and c. Just the number of dots and the previous number of dots. First do your calculations to get numberOfDots. Then assign your strings, and then save the current number as the previous number.
labelString1 = sprintf('The previous number of dots = %d', priorNumberOfDots); set(handles.prev, 'String', labelString1); labelString2 = sprintf('The current number of dots = %d', numberOfDots); set(handles.pres, 'String', labelString1); totalNumberOfDots = priorNumberOfDots + numberOfDots labelString3 = sprintf('The total number of dots = %d', totalNumberOfDots); set(handles.total, 'String', labelString1); % Save current number as previous for next time through this code. priorNumberOfDots = numberOfDots; % or totalNumberOfDots, whatever you want.