How to use the createTask to capture the hardware data
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
edeson
el 1 de Feb. de 2024
Respondida: Damian Pietrus
el 6 de Feb. de 2024
Hi,
I learning the createtask demo, for example
c = parcluster(); % Use default profile
j = createJob(c);
createTask(j, @rand, 1, {10,10});
createTask(j, @rand, 1, {2,10});
createTask(j, @rand, 1, {10,3});
submit(j);
wait(j);
taskoutput = fetchOutputs(j);
disp(taskoutput{1});
disp(taskoutput{2});
disp(taskoutput{3});
the step is
use the parcluster() function to set the profile
add job to cluster by createJob() function
and add the task to job by createTask() function
sumbit the job
and wait all worker to finish all task
the last, get the all task output by fetchOutputs()
in the application, if I create 2 Task,
the first, createTask(j, @getUartInterfaceData, ... .... ....);
the second, createTask(j, @ProcessUartInterfaceData, ... .... ....);
if i want read the UART Hardware to matlab using the first task, and process the Receive Data using the second task at the same time in real time, the answer:
how the share the data between two task ?
how the run the two task in loop ?
0 comentarios
Respuesta aceptada
Damian Pietrus
el 6 de Feb. de 2024
When using createJob/createTask, each task is completely independent. This means that you wouldn't be able to interactively take information from one task and send it to another while they are running.
I think you have two options you could try. If "real time" communication is not required and you don't mind a delay, you could run the first task to get the interface data, fetch the output, and then use that as an input to the process data task after. Another option might be to use an spmd block, since you can use spmdSend / spmdReceive to share data between workers.
If you share more information about your workflow there might be some other options as well
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!