フィルターのクリア

Problem In parfor loop

2 ビュー (過去 30 日間)
Amit
Amit 2023 年 12 月 24 日
コメント済み: Matt J 2023 年 12 月 24 日
Hello All.
Here, k is image matrix with size of 2920x3756x501; 501= frame number. I want to get the intensity profile for all of these frames from the the specific X and Y co-ordinates value. In 2nd for loop, I was trying to align signals. I was trying the computation in parfor lop for both of the for loop. Getting continoulsy error , sometimw showing warning of broadcast variable, or sometime I am getting empty matrix D.
Assistance is genuinely appreciated !!!
Thank you
function [D] = ReducedData_DelayShift_Calculate(x_coordinates, y_coordinates,c_ref,num_frames)
% Initialize a matrix to store improfile data
improfile_data_matrix = [];
D = zeros(1,num_frames);
k = load("reduced_data.mat");
for i = 1:num_frames
% Extract the i-th frame from the image matrix
current_frame = k.images_resized(:, :, i);
% Compute the improfile
improfile_data = squeeze(improfile(current_frame, x_coordinates, y_coordinates));
% Append the improfile data to the matrix
improfile_data_matrix = [improfile_data_matrix improfile_data(:,1)];
end
for i = 1:num_frames
current_frame = improfile_data_matrix(:, i);
[~ ,~ ,D(i)] = alignsignals((c_ref(:)),(current_frame(:)),Method="xcorr");
end
end
  1 件のコメント
Matt J
Matt J 2023 年 12 月 24 日
sometime I am getting empty matrix D.
That most likely means that num_frames=0.

サインインしてコメントする。

採用された回答

Matt J
Matt J 2023 年 12 月 24 日
編集済み: Matt J 2023 年 12 月 24 日
I would get rid of the first for-loop and use interp3
function [D] = ReducedData_DelayShift_Calculate(x_coordinates, y_coordinates,c_ref,num_frames)
k = load("reduced_data.mat");
[xq,zq]=ndgrid( linspace( x_coordinates(1), x_coordinates(2),2000 ), 1:num_frames );
yq=repmat( linspace( y_coordinates(1), y_coordinates(2),2000 )' ,1,width(xq));
improfile_data_matrix = ...
reshape( interp3(k.images_resized, xq(:),yq(:),zq(:)) ,[],num_frames);
D = zeros(1,num_frames);
parfor i = 1:num_frames
current_frame = improfile_data_matrix(:, i);
[~ ,~ ,D(i)] = alignsignals( c_ref(:), current_frame(:) ,Method="xcorr");
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by