Clear Filters
Clear Filters

Undefined function 'dts_cast_with_warning' for input arguments of type 'matlab.ui.Figure'.

12 views (last 30 days)
Hello,
I'm implementing a function in mex file (on GPU) in MALTLAB. But I faced with the following error in MATLAB:
Undefined function 'dts_cast_with_warning' for input arguments of type 'matlab.ui.Figure'.
Error in BPmimo2C (line 98)
figure
Error in test (line 29)
BPmimo2C_mex( Efield, f_par, xyz_par, TX, TY, numT, numR)
Here is where this error occurred (in the "figure" part):
...
...
...
for j = 1:numel(z)
hf(j,:,:) = z(j);
end
figure %************** here is where the error occurred
% figure(1);
er = squeeze(max(image,[],1));
h = surf(squeeze(uf(1,:,:)),squeeze(vf(1,:,:)),er);
colormap(jet);
set(h,'LineStyle','none');
view(2);
Please help me solve this problem.
Thank you

Answers (1)

Ayush
Ayush on 16 Jul 2024 at 9:26
From the error message shared by you it looks like MATLAB calls function named "dts_cast_with_warning" when the built-in "figure" function is called in the provided code snippet. This might be due to some internal issue or conflict with your MATLAB environment.You can try the following workarounds for resolving this issue:
1. Recheck for custom functions names that are being repeated in your codebase specifically "figure" or "dts_cast_with_warning"
2.Clear your workspace to remove any cache files to avoid any potential conflicts. You can use the following commands to perform the same:
clear all;
close all;
clc;
restoredefaultpath;
rehash toolboxcache;
3. Check for the MATLAB Path of the "figure" function to ensure that there are no other similar named functions in the workspace and the built-in function is being called. You can leverage the following command for the same:
which figure -all
4. Lastly you can try explicitly calling the built-in figure function using the "built-in" function call in MATLAB. You can refer to the following documentation:
If the issue still persists, you can try updating your MATLAB to the latest version as well since any underlying bugs or issues could be fixed. Hope this helps!

Categories

Find more on Get Started with GPU Coder in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!