Matlab 编码器错误 "for loop index expressions.." 如何修改代码?
Matlab coder error "for loop index expressions.." how to modify code?
在 Matlab 编码器上,每当我用于索引 for 循环中的向量时,我都会收到错误"未知大小的 FOR 循环索引表达式仅在形式为 A:B 或 A:B:C 时受支持",例如:
for e=s:-1:1
for l=1:s
for k=1:b
E=find(sum(B(:,l,:))==k)';
coder.varsize('E', [1,70],[0,1]);
for j=E
coder.varsize('i', [1,70],[0,1]);
for i=E
if isequal(B(:,e,i),B(:,e,j)) %for k=1 we want the second column of i to be identical to the first colum of j or vice versa.
if isequal(sort(sum(B(1:s,s+1:b+s,i))),sort(sum(B(1:s,s+1:b+s,j))))
B(:,l,i)=B(:,l,j);
B(l,:,i)=B(l,:,j);
else
;
end
end
end
end
end
end
end
我知道编码人员需要类似"A:B"的东西,但我的向量 E 在这里包含例如 [7,11,13],我不能使用类似"E(1,1):E(1,3)"的东西,因为那样我就会得到 7 8 9 10 11 12 13。
关于如何修改代码的任何建议?
谢谢
为什么不简单地做:
for ind = 1:length(E)
i = E(ind);
% ...
end
相关文章:
- 我应该如何修改此代码以使用给定字符串中的字母打印菱形图案
- 修改 VS Code 中的默认C++代码段
- 如何修改代码以打印出数组 v2
- 修改链表主函数代码,用户将在其中输入节点的索引和数据以及正确的消息
- 代码错误修改
- 我在代码中收到一个运行时错误,该错误如何通过修改最多一个元素来查找数组是否可以变得不减少
- 如何跟踪通过外部代码修改类变量的所有位置
- "check if member exists using enable_if"中修改的代码不起作用
- 我在让我的代码输出整个链表时遇到问题.它只是输出我修改过的一些文本文件,而不是整个东西
- 张量流内核代码修改
- 代码审查:常量字符 * 修改
- 如果我制作一个代码,每个线程都会修改数组的完全不同的部分,则将保持缓存相干性
- 如何查看修改后的代码,其中对内联函数进行了预处理
- 是否可以有一个零成本assert(),这样代码就不必在调试和发布版本之间进行修改
- Matlab 编码器错误 "for loop index expressions.." 如何修改代码?
- 如何修改CUDA代码以获得100%的GPU负载
- 自修改代码vs编译器优化vs重复代码
- 创建一个txt文件来调用f2(),而不修改代码
- 通过GUI修改代码
- 如何从用户输入修改c++代码