How to convert Matlab program into visual basic? Entry level at VB.
6 次查看(过去 30 天)
显示 更早的评论
%list of parameters to be logged
Param{1} = 'Acceleration';
Param{2} = 'Speed';
Param{3} = "Breaking';
%time rate
Rate = 100;
logFileName = fullfile(pwd,'Log1.csv');
monitorMode = 'RequestReceive';
loggingMode = 'Alldatareceived';
%double value can be passed
result = widgetwrapper.StartLoggin(param,Rate,monitorMode,logFileName,loggingMode,0);
pause(10);
widgetwrapper.StopLogging();
msgbox('RequestReceive with All data mode logging complete');
logFileName = fullfile(pwd,'Log2');
monitorMode = 'EDM';
result = widgetwrapper.StartLogging(param, Rate, monitorMode, logFileName, loggingMode, 30);
pause(10);
widgetwrapper.StopLogging();
msgbox('EDM with all data mode logging complete');
0 个评论
回答(1 个)
Walter Roberson
2019-11-3
widgetwrapper appears to be some Java code from NorthWestern University.
Converting java to VB is outside the scope of MATLAB Answers.
We do not deal much with VB here, and what we do is more about the interface between MATLAB and VB.
The code appears to log 10 seconds of data of an EDM to a file. It is not really clear what "EDM" means for the purpose of this program; it might possibly refer to Electronic Distance Measurement; https://en.wikipedia.org/wiki/Rangefinder but the parameters mentioned would tend to suggest Accelerometer or possibly vehicle network instrument logging more than range finder to me.
Effectvely MATLAB is just acting as a carrier program to activate the interesting actions in Java. You are going to need to concentrate on calling Java from VB. See https://social.msdn.microsoft.com/Forums/vstudio/en-US/36d0cd27-071f-41de-8d03-633bf43f041c/call-java-class-from-visual-basic?forum=vbgeneral and https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2633&lngWId=2
1 个评论
Guillaume
2019-11-3
In any case, it's not even clear what VB the OP is talking about. It could be the long deprecated VB6, it could be VBA or maybe VB.Net. If the latter, why not use matlab compiler to generate a .Net library.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!