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 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by