Info

此问题已关闭。 请重新打开它进行编辑或回答。

Hie, how can i solve this error, "Index exceeds matrix dimensions"

1 次查看(过去 30 天)
The code is as below;
repelem = {};
for ii = 1:numel(subset)
subsetLabels(ii) = repelem((subset(ii).Description),subset(ii).Count,1);
end
Then the error is;
Index exceeds matrix dimensions.
Error in SignLive (line 19)
subsetLabels(ii) = repelem((subset(ii).Description),subset(ii).Count,1);
THANK YOU IN ADVANCE FOR YOUR UNWAVERING SUPPORT AND HELP.
  5 个评论
KSSV
KSSV 2020-6-16
repelem is a inbuilt function.....you are not supposed to use like that. What version you are using?

回答(1 个)

KSSV
KSSV 2020-6-16
编辑:KSSV 2020-6-16
Try:
N = numel(subset) ;
subsetLabels = cell(N,1);
for ii = 1:N
subsetLabels{ii} = repelem((subset(ii).Description),subset(ii).Count,1);
end

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by