Field II kidney example does not work due to "Requested array exceeds the maximum possible variable size." error

조회 수: 7 (최근 30일)
I am trying to run on my computer example provided by FIELD II site: Field II Ultrasound Simulation Program (field-ii.dk). I create all the simulated rf-data as in example. When it comes to produce B-mode image function fast_int is called. It's .C program for fast interpolation. On the website was given fast_int.mexw32 file only so I converted .c file using mex function into .mexw64. And it does not work even though all my variables are set exacly as in the example.
I provide below given message and fast_int code in txt format. If anyone could direct me why this example is not executable in my case i would highly appriciate. I wonder if this example was run on different system or matlab version and somehow there was no variable size problem? I am not familiar with c programming so i am not sure where exacly in the main function problem occurs.

채택된 답변

James Tursa
James Tursa 2023년 9월 20일
At first glance this is the obvious problem in the original source code: The dimensions array needs to be the proper integer size for API calls, so you need to change this:
int dimension[2];
to this
mwSize dimension[2];
Also, you may get a compiler warning on this conversion:
(unsigned char *) mxGetPr(etc)
so I would change it to this instead:
(unsigned char *) mxGetData(etc)

추가 답변 (1개)

Himanshu
Himanshu 2023년 9월 20일
Hey,
I understand that you are encountering the error "Requested array exceeds the maximum possible variable size" when trying to run a MEX function.
This error typicallyoccurs when your code asks MATLAB to create an array which is larger than MATLAB can theoretically create. The requested array would have more elements than the maximum number of elements an array can possibly have in MATLAB.
Here are some ways of handling the error:
  1. Try to reduce the size of the problem.
  2. Change the type of the variable being used to ensure that the array takes less space.
  3. Divide the problem into smaller subproblems.
For a detailed description of the error and ways of handling the problem, you can refer to the following MALTAB Answer:

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by