Borrar filtros
Borrar filtros

USBオシロスコープ​からpcに転送されて​くる一定区間の時系列​データの処理を並列化​させたいです。

8 visualizaciones (últimos 30 días)
元幹 井上
元幹 井上 el 17 de En. de 2024
Respondida: Varun el 22 de En. de 2024
USBオシロスコープからpcに転送されてくる一定区間の時系列データの処理を並列化させたいです。通常はオシロで測定する時間を指定して、得られた時系列データに対して、そのまま同一のファイル内で処理を実行しているのですが、オシロスコープから転送されてくる一定区間の時系列データを等間隔に分割し、処理を並列化させ、各処理で1列のベクトルAが得られるのですが、最終的にこのAを統合させたいです。parforを使って色々とチャレンジしてみたのですが、上手くいかないのでアドバイスお願いします。

Respuestas (1)

Varun
Varun el 22 de En. de 2024
こんにちは、元幹 井上さん、
私はあなたの質問に英語で回答します。
Looks like you want to parallelize the processing of time-series data within a specific interval, transferred from the oscilloscope by splitting it into equally spaced segments, parallelize the processing of each segment and obtain a vector for each process.
You can use the “parfor” loop in MATLAB to achieve the above goal. Please refer to the following example:
% Assuming you have the time-series data stored in a variable, let's call it 'data'
% Specify the number of segments to divide the data into
numSegments = 4; % Adjust this based on your requirements
% Calculate the number of data points in each segment
segmentSize = numel(data) / numSegments;
% Initialize a cell array to store the results from each segment
resultCell = cell(1, numSegments);
% Use parfor loop to process each segment in parallel
parfor i = 1:numSegments
% Calculate the start and end indices for the current segment
startIdx = round((i - 1) * segmentSize) + 1;
endIdx = round(i * segmentSize);
% Extract the current segment of data
currentSegment = data(startIdx:endIdx);
% Perform your processing on the current segment and store the result
resultCell{i} = yourProcessingFunction(currentSegment);
end
% Combine the results from all segments into a single vector
resultVector = vertcat(resultCell{:});
Make sure to replace “yourProcessingFunction” with the actual function or code that processes each segment of data.
Please refer to the following documentation to learn more about using “parfor” loop:
Hope it helps.

Categorías

Más información sobre 並列 for ループ (parfor) en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!