필터 지우기
필터 지우기

How can i convert this simple program from Matlab into visual basic

조회 수: 34 (최근 30일)
Gali Musa
Gali Musa 2018년 4월 6일
댓글: Guillaume 2018년 4월 10일
x_clean(1)=0;
y_c(1)=initial;
for t_c=1:intervals
x_clean(t_c+1)=Pd*t_c;
end
[m,n]=size(x_clean);
y_cc=ones(m,n);
y_clean=y_c*y_cc;
%%ALSO HOW CAN CHANGE y(end) VALUE INTO VISUAL BASIC
Thank you for your kind support

답변 (2개)

Prajit T R
Prajit T R 2018년 4월 9일
Hi Musa
What you can do is to make a DLL (mex) file from your MATLAB script and call that in VB.
Another approach is to call your written MATLAB function from VB. See this link: Call MATLAB function from VB
To rewrite the code entirely in Visual Basic, you can refer the following ML Answers link: Converting MATLAB code to VB code
Cheers
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 4월 9일
Hah, I had forgotten I wrote that!
Gali Musa
Gali Musa 2018년 4월 9일
Dear Sir,
Actually the reason for the conversion is that i want to use a software that is written in Visual Basic, so i have to convert my Matlab code to do that. i have read on the VB example but having difficulty in using loops and how to convert y(end) into VB. i think the last option should be the best solution. can i write VB without using Console.WriteLine and Console.ReadLine.
How can i convert y(end) into VB.
Thank you for your kind support

댓글을 달려면 로그인하십시오.


Guillaume
Guillaume 2018년 4월 9일
y(end) is simply the last element of the array, so you simply have to replace the end by the index of the last element of the array whatever that is. Since in VB all arrays have a fixed size you know what that index is.
  댓글 수: 6
Guillaume
Guillaume 2018년 4월 10일
As I wrote
... or at least, you shouldn't ...
Yes, you can ReDim an array in VB, it's just as bad as growing an array in matlab. There are much better data types available in .Net if you want a dynamic array. Typically, you'll use a List.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by