久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標題:
MATLAB GUI界面關于匯率轉換和存儲匯率計算
[打印本頁]
作者:
lovcn
時間:
2018-1-14 11:15
標題:
MATLAB GUI界面關于匯率轉換和存儲匯率計算
這是我之前課程設計寫的一段代碼,老師讓自主設計我就寫了一個有關于匯率轉換的,包括很多國家的貨幣之間的匯率轉換,還可以用于計算銀行的存儲的日利息,月利息和年利息。
0.png
(6.8 KB, 下載次數: 39)
下載附件
2018-1-14 16:32 上傳
MATLAB源程序如下:
function varargout = Interest_rate1(varargin)
% INTEREST_RATE1 MATLAB code for Interest_rate1.fig
% INTEREST_RATE1, by itself, creates a new INTEREST_RATE1 or raises the existing
% singleton*.
%
% H = INTEREST_RATE1 returns the handle to a new INTEREST_RATE1 or the handle to
% the existing singleton*.
%
% INTEREST_RATE1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in INTEREST_RATE1.M with the given input arguments.
%
% INTEREST_RATE1('Property','Value',...) creates a new INTEREST_RATE1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Interest_rate1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Interest_rate1_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Interest_rate1
% Last Modified by GUIDE v2.5 28-Aug-2016 18:27:40
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Interest_rate1_OpeningFcn, ...
'gui_OutputFcn', @Interest_rate1_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Interest_rate1 is made visible.
function Interest_rate1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Interest_rate1 (see VARARGIN)
% Choose default command line output for Interest_rate1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Interest_rate1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Interest_rate1_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
global type
type=1;
% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton2
global type
type=2;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global money t
t=1;
f1=fopen('money.txt'); %By reading the text file to input the principal
money=fscanf(f1,'%d');
fclose(f1); %close the file
set(handles.text3,'string',num2str(money)); %Display the value in the static text box
axes(handles.axes1);
title('存款本金');
stem(t,money);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Time Amount Type Name
fid=fopen('Bill.txt'); %By reading the text file to input the bill
fscanf(fid, '%s %s',2);
Name=fscanf(fid, '%s',1); %obtain the user's name
fgetl(fid);
fgetl(fid);
Time=[];
Amount=[];
Type=[];
while ~feof(fid);
Time=[Time,fscanf(fid, '%d ',1)]; %obtain the time of deposit or withdrawals
Amount=[Amount,fscanf(fid, '%f ',1)]; %obtain the amount of deposit or withdrawals
Type=[Type,fscanf(fid, '%c ',1)]; %obtain the type of deposit or withdrawals
end
Name
Time
Amount
Type
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global e
n=get(handles.popupmenu1,'Value');
e=n;
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global e money Rate Loan_rate
fid=fopen('Data.txt'); %By reading the text file to obtain the rate of deposit and loan ,exchange rate
fgetl(fid); % returns the next line of the specified file, removing the newline characters.
Exchange=[]; %exchange rate
Rate=[]; %the rate of deposit
Loan_rate=[]; %the rate of loan
while ~feof(fid);
Rate=[Rate,fscanf(fid, '%f ',1)];
Exchange=[Exchange,fscanf(fid, '%f ',1)];
Loan_rate=[Loan_rate,fscanf(fid, '%f ',1)];
end
Exchange_rate=Exchange(e);
amount0=money*Exchange_rate;
set(handles.text4,'string',num2str(amount0)); %Display the converted amount in the static text box
set(handles.text6,'string',num2str(Exchange_rate)); %Display the exchange rate
axes(handles.axes1);
title('外匯匯率');
x=1:1:6;
stem(x,Exchange);
% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu2
global t_deposit
m=get(handles.popupmenu2,'Value'); %Choose the currency
t_deposit=m;
% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Rate type t_deposit money amount1 t_loan Loan_rate
switch type
case 1
switch t_loan
case 1 %loan for one year
amount1=(Loan_rate(1)+1)*money;
set(handles.text11,'string',num2str(Loan_rate(t_loan)));
set(handles.text9,'string',num2str(amount1));
case {2,3,4,5} %loan for 2~5 years
amount1=(Loan_rate(t_loan)+1)^t_loan*money;
set(handles.text11,'string',num2str(Loan_rate(t_loan)));
set(handles.text9,'string',num2str(amount1));
case {6,7,8,9,10} %loan 6~10 years
amount1=(Loan_rate(6)+1)^t_loan*money;
set(handles.text11,'string',num2str(Loan_rate(6)));
set(handles.text9,'string',num2str(amount1));
end
case 2
switch t_deposit
case 1
amount1=(Rate(t_deposit+1)/4.0+1)*money;%Time deposit for three months
case 2
amount1=(Rate(t_deposit+1)/2+1)*money; %Time deposit for six months
case 3
amount1=(Rate(t_deposit+1)+1)*money; %Time deposit for one year
case 4
amount1=(Rate(t_deposit+1)+1)*(Rate(4)+1)*money; %Time deposit for two years
case 5
amount1=(Rate(t_deposit+1)+1)*(Rate(5)+1)*(Rate(5)+1)*money; %Time deposit for three years
end
set(handles.text9,'string',num2str(amount1));%diaplay the principal and interest
set(handles.text11,'string',num2str(Rate(t_deposit+1)));%display the rate
end
axes(handles.axes2); %draw the matchstick picture of the diffrent
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
所有資料51hei提供下載:
實驗1(Interest Rate).zip
(43.95 KB, 下載次數: 18)
2018-1-14 11:15 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
nishiye
時間:
2018-9-3 19:46
太復雜了,有點看不懂啊,能不能求一個只有幾種貨幣互相轉換的,不要利息部分的,簡單一點就好,學習學習就好,可以嗎?
作者:
nishiye
時間:
2018-9-10 19:15
太復雜了,有點看不懂啊,能不能求一個只有幾種貨幣互相轉換的,不要利息部分的,簡單一點就好,學習學習就好,可以嗎?
歡迎光臨 (http://www.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
аⅴ资源新版在线天堂
|
日本二区在线观看
|
国产精品久久久久久久久图文区
|
香蕉国产在线视频
|
久久99精品久久久久久国产越南
|
天堂成人国产精品一区
|
国产免费看
|
精品福利视频一区二区三区
|
国产一区二区三区精品久久久
|
欧洲色综合
|
国产精品免费大片
|
激情av免费看
|
91传媒在线播放
|
欧美精品一区二区三区在线播放
|
青青青伊人
|
国产精品123区
|
成人影
|
亚洲天天干
|
国产一区二区不卡
|
欧美一区免费
|
一级毛片免费视频
|
日干夜干
|
亚洲欧美视频在线观看
|
黑人性hd
|
人人干在线视频
|
精品欧美一区二区三区久久久
|
91麻豆产精品久久久久久
|
中文字幕 国产精品
|
日韩α片
|
久久久久无码国产精品一区
|
国产成人在线视频
|
www.国产
|
一道本不卡视频
|
欧美国产视频一区二区
|
欧美一区二区三区在线观看视频
|
精品在线一区二区三区
|
欧美一区二区三区在线观看
|
欧美日韩在线观看一区二区三区
|
亚洲国产精品一区
|
国产免国产免费
|
国产免费观看一区
|