- you can't. You would need to send over the RGB image data from VB to MATLAB, e.g. by using the PutWorkspaceData method
- the way you have desgined your function you can't. You would need to make the RGB channels output variables
Calling MATLAB functions in Visual Basic
2 ビュー (過去 30 日間)
古いコメントを表示
I made a very simple program to try how to call matlab functions in visual basic. My matlab program is this:
function showRGB()
origImage = imread('imagefromvisualbasic.jpg');
redChannel = origImage(:,:,1);
greenChannel = origImage(:,:,2);
blueChannel = origImage(:,:,3);
end
Here's the GUI of the app made in vb.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155166/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155167/image.jpeg)
1. How will I use the imread in matlab to read the image from the openDialogBox of VB?
2. How will I use access the output from MATLAB to show the RGB Channels in the picture box?
Thank you
0 件のコメント
採用された回答
Friedrich
2014 年 1 月 16 日
編集済み: Friedrich
2014 年 1 月 16 日
Hi,
function [redChannel ,greenChannel,redChannel] = showRGB()
and then call the Execute method
ml.Execute("[a,b,c] = showRGB()")
to create the variables a, b and c in the base workspace which you then can get to VB by calling GetWorkspaceData. The example you mentioned does all that.
6 件のコメント
Friedrich
2014 年 1 月 20 日
I am not really VB programmer but I guess you have to call the save method and save the image into a stream. As a stream use some byte array. I guess googling for that task should give some hints.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!