From: Robert on 20 Apr 2010 09:07 "Claudia " <claudiaae(a)hotmail.com> wrote in message <hkrsql$sds$1(a)fred.mathworks.com>... > I'm working on a project which includes a matlab/simulink simulation and an user-interface in c#. > what i do is starting a matlab application from my c# gui, that works fine. > The simulation ends only if a given value is reached. so the endpoint is inf. > > my problem is, if the user makes a mistake and the endvalue is not reachable I'm not able to stop the simulation... except of killing the process... > is there a way to stop the simulation, if it was started with the sim command? > > I already had a look in the net for a solution and found out, that probably the set_param() command is better to use, because it allows to start and stop the simulation. but the strange thing about the set_param command is that the simulation ist not constantly running if I start it with this command. > > if i start the simulation from the c# application and want to run the sequence every second it works fine with the sim-command but with the set_param command the simulation is slower. how is this possible? is there a thread-problem with the c# application? > > if i start the matlab simulation in matlab and not from my c# application the timing is fine with the sim-command and set_param command. > > I would be very thankful if anyone could help me. I already spent a lot of time on this problem. > > regards > claudia Can you please explain, how do you call the sim() command wihtin your c# app? I tried to do the same, but it won't work. Always getting this error msg: "MWMCR::EvaluateFunction error: Undefined function or method 'sim' for input arguments of type 'char'.Error in =>start_and_write.m at 3." Well in line 3 you can find the sim-command. The function works fine in MATLAB but not as an .net assembly... Code: function [success] = start_and_write() sim('MyModel.mdl') save Output.mat if exist('Output.mat','file') success = 1; else success = 0; end
|
Pages: 1 Prev: calculation of cost function Next: Object removal Region Filling Help Needed. |