I am having a bit of problem with calling my functions within my nested for loops and was wondering if anyone could figure it out...
new_location = 50x2 matrix of cell locations * 0.1
B = 150x150 matrix of rand vals
for j = 1:numel(new_location(:,1))
for k = 1:numel(new_location(:,2))
if new_location(j + 1) - new_location(j) < 0.3
final_location = check_intensity(B(j),B(j + 1),new_location(j),new_location(j + 1));
else if new_location(k + 1) - new_location(k) < 0.3
final_location = check_intensity_2(B(k),B(k + 1),new_location(k),new_location(k + 1));
else
;
end
end
end
end
User-defined functions:
function final_location = check_intensity(B(j),B(j + 1),new_location(j),new_location(j + 1))
if B(j) > B(j + 1)
final_location(j) = new_location(j);
else
final_location(j) = new_location(j + 1);
end
My error is simply saying:
Error: File: check_intensity.m Line: 1 Column: 44 Unbalanced or unexpected parenthesis or bracket.
Error in coord_1_sb (line 36) final_location = check_intensity(B(j),B(j + 1),new_location(j),new_location(j + 1));