How can I use c# picturebox to show matlab‘ fig?

I want show fig in my c# picturebox.It will show a messagebox “Application error--0xe0434f4d and 0x7c812aeb"
main code of C#:
st.mathplot((MWNumericArray)mt_a, (MWNumericArray)mt_d, (MWCharArray)mt_c, (MWCharArray)mt_xlab, (MWCharArray)mt_ylab);
//string command1;
String path = Directory.GetCurrentDirectory();
path = path + "C:\test1.jpg";
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = Image.FromFile(path);
the st.mathplot is matlab'file like:
function mathplot(h,D,xlabel1,ylabel1,title1)
for x=-10:0.1:10,
if x>D
y=h;
hold on;
xlabel(xlabel1);
ylabel(ylabel1);
title(title1);
plot(x,y);
elseif x<-D
y=-h;
hold on;
xlabel(xlabel1);
ylabel(ylabel1);
title(title1);
plot(x,y);
else
y=h/(D*x);
hold on;
xlabel(xlabel1);
ylabel(ylabel1);
title(title1);
plot(x,y);
set(gcf,'color',[1,1,1]);
%mkdir image;
% ========================
saveas(gcf,'C:\test1.jpg','jpg')
end
end

Answers (0)

Categories

Find more on Printing and Saving in Help Center and File Exchange

Asked:

on 29 Mar 2012

Community Treasure Hunt

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

Start Hunting!