Python packages creating package error

3 visualizaciones (últimos 30 días)
Rakesh
Rakesh el 14 de Oct. de 2022
Respondida: Jaswanth el 12 de Jun. de 2024
Hello,
I am new to matlab Python package generation.
I have created m file and its working fine when run on Matalab, But i want to convert that file to python package, while converting python package its giveming me Error :
Failed to package Sample Generation for "imageAnalysisSample2.m". Additional details:
obj is not supported for Sample Generation. Arguments must be char, logical, numeric, or structs or cell arrays of these arguments.
Thanks
Rakesh Patel

Respuestas (1)

Jaswanth
Jaswanth el 12 de Jun. de 2024
Hi Rakesh,
The error message you are encountering suggests that the ‘imageAnalysisSample2.m’ file you are trying to convert into a Python package uses an input argument of a type that is not supported by MATLAB's Python package generation process. Specifically, it mentions that ‘obj’ is not supported for Sample Generation.
As a possible workaround, you can pass the argument as ‘structs’ or ‘cell arrays’ instead of ‘obj’.
For example, if you have a class instance, you can convert it to a ‘struct’ for the purposes of interfacing with Python as shown below:
% Example of converting an object to a struct
objStruct = struct(obj);
Kindly refer to the following MathWorks documentation to know more about the struct function:
I hope the information provided above is helpful.

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by