i want to create an array (like Profit(n1) and Sale(n1)), when push button is pressed, but the problem is when button is pressed only current value is store at 'n1' but the previous values remove from array and become zero. plz help in this regard..
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
function PB1_Callback(hObject, eventdata, handles)
% hObject handle to PB1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clc;
handles.counter = handles.counter + 1; % Counter
n1 = handles.counter;
% get the string data from the three edit controls
str1 = str2num(get(handles.ET2,'String')); % Code
str2 = str2num(get(handles.ET3,'String')); % Price
str3 = str2num(get(handles.ET4,'String')); % Count
% do some work
Profit(n1) = (str2 - (str1 - 203)) * str3; % Calculate Profit
Sale(n1) = str2; %calculate Sale
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Whos in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!