Script for update source mode




I read from an old post that it is not possible to select modes by scripting. I have tried to insert the below commands in my script and it gave me wrong result. But, when I execute the same commands in the command window, it gives correct mode index. My question is that is there any way to select higher order modes by scripting. I am sweeping some parameters so manually selecting modes is really cumbersome.

select(“mode source”");
neff_source = getresult("“mode source”, “neff”);


Hi @nouman.zia

Your script should work. You need to select the number of mode of interest in the updatesourcemode script command:

select("mode source"); 
neff_source = getresult("mode source", "neff"); 

Please elaborate what were the wrong results that you obtained in your scripts.

I hope this answers your inquiry.


Hi @bkhanaliloo,
Let’s take this simple example: geometry_tilt_RWG.lsf (9.6 KB)

I am selecting ‘mode 1’ (line 259) and expanding for the ‘mode 1’ (line 357) but I get different T_backward and T_forward than selecting these modes manually. Also, the script for finding the neff for mode source is giving some strange index.


Hi @nouman.zia

I am not seeing any problem with updatesourcemode or updatemode commands. They correctly modify the mode of interest.

The neff results also obtained from mode source is correct:

I am not sure what was the problem here. Please elaborate on your problem and I will be happy to be of a help.


Hello @bkhanaliloo,
It works fine in command window but when I use the set of commands in the script file and run that, I get wrong index. Please take a look here: