I have a 1×3 cell array, where each layer is 512 x 512, returned by a function. I want to scan through the cell at every pixel and determine the maximum angle. The code that I have written is working fine, but I feel that it can be made more simple by using the features of cell.
Also if the cell dimensions change, say from 1×3 to 1×5 then this code has to be reworked. Please suggest the necessary changes.
max_edges_anglesR = zeros(size(R_portion)); % Creating a matrix to hold maximum values
C1 = Ang_F1{1,1}; % Ang_F1 is the array, and one layer is assigned to C1, C2 etc
C2 = Ang_F1{1,2};C3 = Ang_F1{1,3};for i=1:1:size(C1,1) for j=1:1:size(C1,2) C1_angle = angle(C1(i,j)); % for a given (i,j), temporarily store
C2_angle = angle(C2(i,j)); C3_angle = angle(C3(i,j)); max_angle = max([C1_angle, C2_angle, C3_angle]); % Find the max
max_edges_anglesR(i,j) = max_angle; endendimshow(max_edges_anglesR); title('Max angles'); figure
Best Answer