Matlab coder logical indexing structs

8 ビュー (過去 30 日間)
Mohammed Kagalwala
Mohammed Kagalwala 2020 年 2 月 18 日
編集済み: Stephen23 2020 年 2 月 18 日
Hello,
I currently have a struct defined as such,
struct(1).a
struct(2).a
struct(3).a
...
struct(N).a
where the field a is a 3x3 matrix. When I'm attempting to convert Matlab code to C through the code I run into the follwing error when trying to access the above struct through a logical index, lg.
What I'm attempting:
b = blkdiag(struct(lg).a);
Error I get:
"Directly accessing field or property of nonscalar struct or object not supported for code code generation."
I'm not fully understanding the error. Furthermore isn't 'struct' a scalar struct in this case. Note: 'struct' does have other fields that are matrices, scalars and logicals as well.
  2 件のコメント
Mohammed Kagalwala
Mohammed Kagalwala 2020 年 2 月 18 日
I do not have a struct named struct, this is just a simple label for example purposes. From some trial and error it seems the C Coder does NOT support the use of logicals to index into such structs

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by