Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Program doens't run until I add a blank row in the script...

Subject: Program doens't run until I add a blank row in the script...

From: Camille Couzi

Date: 29 Aug, 2011 02:15:27

Message: 1 of 5

Heu matlabers,

I am facing a very very strange problem with matlab. if sonebody is able to give me an answer, I will be very greatful.

I am running a GUI, which calls a function. This functions uses a library loaded with Net.addAssembly. As I am a beginner in Net.addAssembly, I don't know if my problem comes from this library, or in fact it is a matlab problem.

When I open my maltab session and launch the GUI (which calls this function), I get an error:
Undefined function or variable 'Factory'
Factory is one of the functions that inside the assembly that I load.

Well, If I go to my function script, and just add a blanck row and save the function with this change, and run again the GUI, it works fine without sending me an error message...

Has somebody faced this problem sometime?
Thanks in advance for your help..

Camille!

Subject: Program doens't run until I add a blank row in the script...

From: Bruno Luong

Date: 29 Aug, 2011 06:11:11

Message: 2 of 5

I suspect the cause is not the blank line, but may be you load and call in reverse order, or simply the fact that you forgot to save the file in the failed test.

Bruno

Subject: Program doens't run until I add a blank row in the script...

From: Camille Couzi

Date: 29 Aug, 2011 06:43:10

Message: 3 of 5

Ey bruno,
Thanks for your quick reply. I have been relaunching my program again and again in order to understand what could be failing.
1st test:
-I open matlab, open my gui and launch it, it crashes.
-I change the directory to another script which uses the same function and net.addassembly and which works (without closing my gui), and then come back to my gui, and then it works.

I close matlab.
2nd test:
-I open matlab, open my gui and launch it, it crashes.
-I write in the command window: clear all (without closing my gui).
- I come back to my GUI and launch it. and it works.

I think it is something close to what you say "maybe you load and call in reverse order": when I clear all or just simply launch another program that clear the temporal variables, and i come back to my gui, it works... The VERY STRANGE thing is that I have reviewed again and again my script comparing it to another script that works, and it has exactly the same structure. but it is something related to variables... i am quite sure.

"simply the fact that you forgot to save the file in the failed test": yes I close the file in the failed test. or perhaps matlab doens't go until the line where I close the file, so the file is still open and that's why matlab crashes...

what a headache!!!!!!!!
thanks for your ideas, if you think about something else, you are more than welcome!

cheers,
Cam*


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <j3fahv$ruv$1@newscl01ah.mathworks.com>...
> I suspect the cause is not the blank line, but may be you load and call in reverse order, or simply the fact that you forgot to save the file in the failed test.
>
> Bruno

Subject: Program doens't run until I add a blank row in the script...

From: Jesper

Date: 1 Sep, 2011 12:53:07

Message: 4 of 5

Hi there

It seems like there is a difference in using the NET.addAssembly from within a script and from within a method.

I have tried what you have done with a simple function just doing an addAssembly, and import statement and then creating an object from the assembly. That does not work out of the box.

However, if I move the NET.addAssembly outside the function and into a script, that is executed before the function, then it works fine.

That is at least how it seems to work in Matlab R2010a. Seems like a bug in Matlab? At least it is behaving inconsistent.

Best regards
Jesper

Subject: Program doens't run until I add a blank row in the script...

From: Camille Couzi

Date: 2 Sep, 2011 07:31:26

Message: 5 of 5

Thanks a lot Jesper!!!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us