How to create windows forms in MATLAB?
조회 수: 6 (최근 30일)
이전 댓글 표시
I want to know how to create windows forms using MATLAB? Will it be like vb.net?
댓글 수: 0
채택된 답변
Martijn
2011년 1월 31일
I assume you are talking about .NET's Windows Forms, if so you would need to start with loading the correct Assembly:
NET.addAssembly('System.Windows.Forms')
Then you can instantiate a new form:
f = System.Windows.Forms.Form;
And for example Show() it:
f.Show
Hint: the IMPORT statement works very similar to VB.NET's Imports. So you can use it to write shorter code:
NET.addAssembly('System.Windows.Forms');
import System.Windows.Forms.*
f = Form; % No fully qualified name necessary anymore
f.Show
For further information on calling the .NET framework, see the MATLAB documentation:
추가 답변 (2개)
Jan
2011년 1월 31일
Please explain what you mean with "windows forms". If you look for graphical user interfaces, read the correpsonding chapters in the documentation.
댓글 수: 0
Frank Cano
2019년 4월 15일
clc;
clear all;
A=[3 4 5 6; 2 3 4 5; 5 6 4 3; 9 8 7 6]
% For bringing the max value of each column at its top
for i=1:length(A)
V=A(:,i); % Separate the column of intrest and save it as a vector V
temp=V(1) % Save its top value so that it does not vanish by over-writing
MAX=max(V); % find the max value in the vector
[nr nc]=find(V==MAX); % find the location of the max value in the form of row number(nr) and column number (nc)
V(1)=MAX; % Now shift the max value to the top by over writing existing value
V(nr,nc)=temp; % bring back the saved value of top element in temp and write it where the MAX was located
A(:,i)=V; % Now your vector is updated.Give it back to matrix A at the right location by over-writing
end
A % Just checking the final result is correct or not
save datafile.dat A -ascii %You can save the matrix in a data file
% For bringing the max value of each column at its diagonal position
for i=1:length(A)
V=A(:,i); % Separate the column of intrest and save it as a vector V
temp=V(i) % Save its appropriate element value so that it does not
vanish by over-writing
MAX=max(V); % find the max value in the vector
[nr nc]=find(V==MAX); % find the location of the max value in the form
of row number(nr) and column number (nc)
V(i)=MAX; % Now shift the max value to the appropriate element
by over writing existing value
V(nr,nc)=temp; % bring back the saved value of appropriate element in
temp and write it where the MAX was located
A(:,i)=V; % Now your vector is updated.Give it back to matrix A
at the right location by over-writing
end
% For bringing the min value of each column at its diagonal position
for i=1:length(A)
V=A(:,i); % Separate the column of intrest and save it as a vector V
temp=V(i) % Save its appropriate element value so that it does not
vanish by over-writing
MAX=min(V); % find the min value in the vector
[nr nc]=find(V==MAX); % find the location of the min value in the form
of row number(nr) and column number (nc)
V(i)=MAX; % Now shift the min value to the appropriate element
by over writing existing value
V(nr,nc)=temp; % bring back the saved value of appropriate element in
temp and write it where the MAX was located
A(:,i)=V; % Now your vector is updated.Give it back to matrix A
at the right location by over-writing
end
% For bringing the max value of each column at its diagonal position
% starting from the last column in reverse order
for i=1:length(A)
V=A(:,length(A)-i+1); % Separate the column of intrest and save it
as a vector V
temp=V(i) % Save its appropriate element value so that it does not
vanish by over-writing
MAX=max(V); % find the max value in the vector
[nr nc]=find(V==MAX); % find the location of the max value in the form of row number(nr) and column number (nc)
V(i)=MAX; % Now shift the max value to the appropriate element by over writing existing value
V(nr,nc)=temp; % bring back the saved value of appropriate element in temp and write it where the MAX was located
A(:,length(A)-i+1)=V; % Now your vector is updated.Give it back to matrix A at the right location by over-writing
end
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!