how can we run two matlab codes simultaneously in a single file where these two are independent to eadh other??

tic
clc; close all; clear all;
delete(instrfindall);
s = serial ( 'COM5', 'BaudRate', 115200);
set(s, 'Timeout',60);
s.InputBufferSize =37020;
tic
fopen(s);
%for i=1:20
data=fread(s);
----------------------------------------------------------
s = daq.createSession('ni');
s.addAnalogInputChannel('cDAQ2Mod1', 0, 'Voltage');
s.addAnalogInputChannel('cDAQ2Mod1', 1, 'Voltage');
s.Rate = 2000
s.DurationInSeconds = 60;
[data5,time] = s.startForeground;
toc

댓글 수: 3

Error using distcomp.interactiveclient/start (line 11)
Found an active interactive session.
You cannot have multiple interactive sessions open simultaneously.
To terminate the existing session, use matlabpool close
i'm getting this error if i'm using parfor or switch case
i want synchronization between both codes
I see no parfor or switch or matlabpool in your code?

댓글을 달려면 로그인하십시오.

 채택된 답변

You might be able to use spmd with two labs, one for the data acquisition and the other for the serial fread(). I do not have enough knowledge of the Parallel Computing Toolbox to be sure that it can be done.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by