- Have two separate .m files, one for each channel.
- Create a new script that initiates a parallel pool.
- Create a job for each channel, Job1 and Job2. You can achieve this by creating a job for each script.
- Create another job Job3 that waits for a specified input. When that specified input is received, terminate that script.
- Send a message to Job1 and Job2 that triggers to complete the execution when Job3 is completed. This step is the equivalent of closing your channels.
- When Job1 or Job2 are triggered to terminate by the main script, close the channels and save the results. The main script when triggering could also send the end-time to the Jobs. This step is equivalent to saving the results.
Run two scripts at the same time
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hey guys, thanks in advance.
I am using LimeSDR to receive samples in two different channels. In one script I am receiving in one channel. And on the other script I am receiving in another channel. I need to run this scripts simultaneously and only stop when I want, and when I stop I would want to save the samples in two different files with time of the samples( the hour, minute and second) it started receiving and stopped receiving). I dont know how can I do that. Thanks a lot.
The code I have, does the reception of the samples in one script, but I want in different scripts, and add the code I refered. Thank you
% Start the module
dev.start();
fprintf('Start of LimeSDR\n');
% Receive samples on RX0 channel
indRx = 1;
[samples, ~, samplesLength] = dev.receive(Fs*Ts,0);
bufferRx(indRx:indRx+samplesLength-1) = samples;
% Receive samples on RX1 channel
indRx1 = 1; % index of the last received sample
[samples1, ~, samplesLength1] = dev.receive(Fs*Ts,1);
bufferRx1(indRx1:indRx1+samplesLength1-1) = samples1;
pause(1)
% Cleanup and shutdown by stopping the RX stream and having MATLAB delete the handle object.
dev.stop();
clear dev;
fprintf('Stop of LimeSDR\n');
0 comentarios
Respuestas (1)
Manas
el 8 de Sept. de 2023
I understand that you want to receive samples from LimeSDR in two different channels simultaneously, and you wish to do so using two separate MATLAB scripts. You also want to stop the scripts on command and store the data in a particular file name format that depends on the starting time and ending time of you receiving samples.
I would encourage you to check out MATLAB’s parallel computing capabilities. Using parallel computing you can run the scripts simultaneously. Refer to this documentation for more context: https://www.mathworks.com/help/parallel-computing/parpool.html
Here is another MATLAB answer that talks about running MATLAB scripts in parallel: https://www.mathworks.com/matlabcentral/answers/318764-how-to-run-two-matlab-scripts-in-parallel
Assuming the two channels work independently of each other, you can base your implementation around this logic:
You can get the end time timestamp using the datetime() function. Refer to this documentation to learn more on how to use it: https://www.mathworks.com/help/matlab/matlab_prog/compare-dates-and-time.html
This is only a general idea on how you can implement the solution. Feel free to modify the above steps to your convenience and requirements.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!