Datos de tamaño variable
Durante la generación de código, el generador de código identifica arreglos, incluyendo escalares, vectores y matrices, como de tamaño fijo o de tamaño variable.
El generador de código designa un arreglo como de tamaño variable si no puede determinar el tamaño del arreglo o si su tamaño cambia.
El generador de código designa un arreglo como de tamaño fijo si puede determinar que el tamaño del arreglo no cambia.
Comprender cómo el generador de código gestiona los arreglos de tamaño fijo y variable ayuda a diagnosticar y resolver los errores durante la generación de código. Si la aplicación no requiere arreglos de tamaño variable, también puede perfeccionar los tamaños variables y la asignación dinámica de memoria para poder mejorar el rendimiento del código generado.
Bloques
| MATLAB Function | Include MATLAB code in Simulink models |
| MATLAB System | Include System object in model |
Funciones
coder.areUnboundedVariableSizedArraysSupported | Check if current configuration settings allow unbounded variable-size arrays (Desde R2024a) |
coder.varsize | Resolve size incompatibility errors and declare upper bounds |
Solución de problemas
Resolve Error: Arrays Have Incompatible Sizes (MATLAB Coder)
Troubleshoot size incompatibility errors that occur during code generation.
Resolve Error: Fixed Size on the Left Side but Variable Size on the Right (MATLAB Coder)
Troubleshoot errors when assigning variable-size arrays to fixed-size arrays.
Resolve Error: coder.varsize Not Supported for Strings (MATLAB Coder)
Troubleshoot code generation error when using coder.varsize
with string variables.
Resolve Error: coder.varsize Not Supported for Class Properties (MATLAB Coder)
Troubleshoot code generation error when using coder.varsize
with properties of a MATLAB class.
Resolve Error: Unable to Produce Column Vector from Scalar (MATLAB Coder)
Troubleshoot error when an input argument that is a variable-length column vector at code generation time is a scalar at run time.
Resolve Error: Incorrect Size for Expression (MATLAB Coder)
Troubleshoot MEX function error when the size of an array at run time is incompatible with the size of the array in the generated code.
