Generate ANN weights as a separate file from Matlab embedded coder and use in VXworks environment

This question is follow up of topic in thread
The code generated has a function to read the BIN file containing neural network weights .
As shown below
Howeever, we want to generate our own handwritten function which initialises the inputBufferPtr from the file path in the OBC.
Is there way to achieve this without modifying the autocode ?
static void readDnnConstants(real32_T *inputBufferPtr,
const char_T *unresolvedFilePath,
int32_T numElementsToRead)
{
int32_T elementSizeInBytes;
const char_T *fileOpenMode;
char_T *resolvedFilePath;
FILE *filePtr;
void *dataBufferPtr;
resolvedFilePath = getResolvedFilePath(unresolvedFilePath);
fileOpenMode = "rb";
filePtr = fopen(resolvedFilePath, (char_T *)fileOpenMode);
dataBufferPtr = &inputBufferPtr[0];
elementSizeInBytes = 4;
fread(dataBufferPtr, elementSizeInBytes, numElementsToRead, filePtr);
fclose(filePtr);
free(resolvedFilePath);
}

답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Get Started with GPU Coder에 대해 자세히 알아보기

제품

릴리스

R2024b

질문:

2025년 3월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by