size mismatch using find command
Show older comments
Hi,
I write the code using find command to find the index of match data in array. But I received an error about mismatch
for j = 1:n
[~,d] = min(abs(V1-Vscan_start(j,1)));
Vscan_start_round(j,1) = V1(d);
Vscan_start_loc(j,1) = find(V1 == Vscan_start_round(j,1));
Isc(j,1) = I1(Vscan_start_loc(j,1));
[~,e] = min(abs(V1 - Vscan_end(j,1)));
Vscan_end_round(j,1) = V1(e);
Vscan_end_loc(j,1) = find(V1) == Vscan_end_round(j,1));
end
The inputs are V1 and I1 which are arrays. The error is on "find" command. When I typed this in command window it works. However, when run in simulink it shows error.
Size mismatch ([1 x 1] ~= [:? x 1]).
Function 'Short term sampling tracking/shorttrack' (#23.1252.1311), line 40, column 5:
"Vscan_start_loc(j,1) = find((V1) == Vscan_start_round(j,1))"
Launch diagnostic report.
Any suggestion for me? thank you so so much in advance
Accepted Answer
More Answers (0)
Categories
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!