From: fabian on 9 Jun 2010 11:14 Dear all, I am having some troubles with a standalone created with rtw from a simulink model, which crashes when executed (window pops up, saying this .exe stopped working). The simulink model consists of some embedded matlab function blocks. I could narrow down the line which makes troubles (see below). However, if I separate this single embedded matlab function block and compile it by itself, it runs fine. So I am thinking that the problem might be related to the allocated memory or something?? [Q2,R2] = qr(MQ); row = 0; col = 0; [row,col]=size(R2); i =0; threshold = 8e-12; for j=1:row if (sum(abs(R2(j,:)))<threshold) i=i+1; TEMP(:,i)=Q2(:,j); %<-- this causes a crash in the overall model end end NULL_MQ = TEMP'; Furthermore, I get the same problem when using a Memory block (or Unit delay block)somewhere within the overall model. The standalone of the overall model crashes, but if I compile a simpler model with these blocks it runs fine? I dont even know what to look for? I am using Matlab R2010a on Windows 7. Any hints are greatly appreciated.
From: Tim on 9 Jun 2010 12:31 "fabian " <fabian.risch(a)mavt.ethz.ch> wrote in message <huob3s$e6v$1(a)fred.mathworks.com>... > Dear all, > > I am having some troubles with a standalone created with rtw from a simulink model, which crashes when executed (window pops up, saying this .exe stopped working). The simulink model consists of some embedded matlab function blocks. I could narrow down the line which makes troubles (see below). However, if I separate this single embedded matlab function block and compile it by itself, it runs fine. So I am thinking that the problem might be related to the allocated memory or something?? > > [Q2,R2] = qr(MQ); > row = 0; > col = 0; > [row,col]=size(R2); > i =0; > threshold = 8e-12; > for j=1:row > if (sum(abs(R2(j,:)))<threshold) > i=i+1; > TEMP(:,i)=Q2(:,j); %<-- this causes a crash in the overall model > end > end > NULL_MQ = TEMP'; > > > Furthermore, I get the same problem when using a Memory block (or Unit delay block)somewhere within the overall model. The standalone of the overall model crashes, but if I compile a simpler model with these blocks it runs fine? > > I dont even know what to look for? > > I am using Matlab R2010a on Windows 7. > > > Any hints are greatly appreciated. I would examine very carefully the auto generated code. In my experience I have seen a lot of embedded matlab generate incorrect c code.
From: fabian on 10 Jun 2010 12:30 > I would examine very carefully the auto generated code. In my experience I have seen a lot of embedded matlab generate incorrect c code. Hi Tim, thanks for your anwer. I had a look at the generated code, but couldnt find any possible error sources. Can you give me a hint what to look for? Or in other words, in which cases did you experience problems? thanks again
From: Steven Lord on 10 Jun 2010 12:56 "fabian " <fabian.risch(a)mavt.ethz.ch> wrote in message news:huob3s$e6v$1(a)fred.mathworks.com... > Dear all, > > I am having some troubles with a standalone created with rtw from a > simulink model, which crashes when executed (window pops up, saying this > .exe stopped working). The simulink model consists of some embedded matlab > function blocks. I could narrow down the line which makes troubles (see > below). However, if I separate this single embedded matlab function block > and compile it by itself, it runs fine. So I am thinking that the problem > might be related to the allocated memory or something?? > > [Q2,R2] = qr(MQ); > row = 0; > col = 0; > [row,col]=size(R2); > i =0; > threshold = 8e-12; > for j=1:row > if (sum(abs(R2(j,:)))<threshold) > i=i+1; > TEMP(:,i)=Q2(:,j); %<-- this causes a crash in the overall > model I would be suspicious of this growing array in the loop -- I would try preallocating TEMP outside the loop and fill it in inside the loop, trimming it to the appropriate size if necessary. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
|
Pages: 1 Prev: Too many input arguments Next: how to disable automatic call of bench function during a run |