Transfering variables between Matlab Sessions

I have a question regarding sessions.
I have a main file with input data
I have a script called sum
I have a script called diff
sum and diff are
run on two different sessions
how do i declare 2 inputs
in main and pass them to
sum and diff???

2 comentarios

dpb
dpb el 7 de Jul. de 2019
If not in same session, you'll have to write the results to be saved to disk (.mat files/save/load are good for this being simple to use) and then recall them when needed.
No the idea is to run two different scripts called sum and diff at the same time. Both will be called by main script. Thas the dea i want to implement for sure.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 7 de Jul. de 2019

0 votos

First of all, DO NOT name your scripts sum and diff because those are two very important built-in function names and you could run into trouble if you ever want to use the built-in functions.
Next, use save() to save variables to a .mat file, and load() to recall those variables from the file to a new session of that script or any other script.

9 comentarios

Ok. Maybe this works, i need to find out. The thing is, in my application, there are dependable files as well. How do we transfer the files as well to the parallell session?
dpb
dpb el 7 de Jul. de 2019
With this and the comment in response to my earlier comment, I think we need a lot more definition of the problem to have any meaningful answer that would bear on the actual situation.
Your response to me was or at least seems to be at complete odds with the initial question conditions; when you bring parallel into the mix, "all bets are off!" with what was an initial apparent serial problem of one script following another.
Ok, here's the problem: I am using a LimeSDR with MATLAB. It's a Software Defined Radio. So i need to transmit a signal to the SDR and receive it back, to test its functionality. Now i have found elsewhere that i would need to transmit and receive concurrently(parrallelly). Therefore i need to run two parallel scripts: one for transmit and the other for receive. SO how do i go about that in MATLAB??
Image Analyst
Image Analyst el 7 de Jul. de 2019
Dependable as in "reliable"?
Or do you really mean "dependent", like a file or set of files depends on another file or set of files being there?
If by parallel you mean the Parallel processsing Toolbox and you have multiple workers running, then you might have to pass stuff in memory and handle any timing/race issues.
The main file calls transmit, and sends variabes to it. So transmit is dependant on main, right?
Then again the receive has to run concurrently with transmit and meanwhile send information back to main. That's dependancy, right?
Image Analyst
Image Analyst el 8 de Jul. de 2019
Yes, that's dependent and dependency. Dependable is en entirely different word, it means like you can count on a person as being reliable and loyal.
So why don't you just pass the variables from the main function to the second function via the functions argument list? This is just standard function usage like everybody knows and uses all the time. You can't get far in MATLAB without learning how to call functions. I think it should have been on the 2 hour training.
I need to pass variables from one session to another. caiuse i need to run parrallel sessions for transmit and receive.
Image Analyst
Image Analyst el 8 de Jul. de 2019
Then why not just transfer things via .mat files?
I guess we don't understand and maybe if you call tech support they can suggest a solution.
Alright, .mat files then!!!

Iniciar sesión para comentar.

Categorías

Productos

Preguntada:

el 7 de Jul. de 2019

Comentada:

el 8 de Jul. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by