size mismatch using find command
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 General Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!