Subscripting into an mxArray is not supported. Cell contents reference from a non-cell array object.

1 次查看(过去 30 天)
I have a Simulink model, there is a MATLAB function CodeBlockSegment. In this function I call the lteCodeBlockSegment function (from LTE Toolbox), which returns the result as a cell array with int8 column vector elements (the size of the vectors changes depending on the input data). I need to get separately each vector that is a subset of the cell array.
I have already tried all possible solutions to the problem from the Internet, but I constantly get various errors. That being said, the same code runs well in a simple matlab .m file.
function segm = CodeBlockSegment(in,num)
coder.extrinsic('lteCodeBlockSegment','cell2mat','cell2table');
cbs1 = lteCodeBlockSegment(in);
tf = iscell(cbs1);%result - 1 ( returns 1 (true) if A is a cell array. Otherwise, it returns 0 (false).)
segm=cbs1{1}; %Cell contents reference from a non-cell array object.
%d = cell2mat(cbs1);
%segm=d(1,1); %Subscripting into an mxArray is not supported.

回答(1 个)

Suman
Suman 2024-9-27
Hi Añ An,
The error "Cell contents reference from a non-cell array object." means that the variable "cbs1" is not a cell array. Try using parentheses instead, "cbs1(1)".

类别

Help CenterFile Exchange 中查找有关 LTE Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by