Getting "Execution of script feature as a function is not supported "

For the below code I got an error as execution of script feature as a function is not supported. Could anyone please help me to get out from this error. My code is
function [dataset,classes ] = load_dataset(file_name)
dataset = readtable(filename,'TextType','string');
classes = "Result";
dataset= convertvars(dataset,classes,'categorical');
if ~isempty(dataset)
disp('Dataset has been loaded')
end

6 commentaires

Jan
Jan le 31 Mai 2022
Modifié(e) : Jan le 31 Mai 2022
Please post a copy of the complete message. This would reveal, which line or command causes the bug.
Avoid using multiple commands in one line of code. This impedes the debugging and the readability.
I inserted line feeds to make it easier to read the code withough having to scroll
My dataset is an excel dataset and the file name is 'cardiomyopathy_dataset.xlsx'. For this dataset i received the above error
That's fine but the problem is the extra feature.m that you have.
Yes, I am already having a matlab file named as feature.m....whether that is cause of this issue
yes, I guarantee you that is the cause of the problem.

Connectez-vous pour commenter.

 Réponse acceptée

which -all feature
will show that you have your own feature.m that is interfering with calling the matlab function feature()

9 commentaires

Thanks a lot for your timely help. I just solved the error
how you solved this problem
which -all feature
and tell us the first two lines of results
Sir, I am also getting same error. See below the picture
I have also type which -all feature, as you see in above picture, but why it is not compiling it. It is saying "private to ompbox".
Main file is MST_SR_main, then it is calling nsct_sr_fuse.m, then calling sparse_fusion, then call omp2. Then in omp2.m file it is calling omp2mex.m.
Please help. I will be thankful to you
opm2mex needs to be compiled for the operating system it is running on. It looks to me as if you are using MATLAB Online, which is a Linux system.
Yes you are right. I am using MATLAB online. Then what is the solution for it.
You need to cd to the ompbox/private directory in MATLAB online, and give the command
!make
A Big Thanks to you Sir! Thank you so much

Connectez-vous pour commenter.

Plus de réponses (1)

vasanthkumar
vasanthkumar le 21 Fév 2023
Hi, i am using MATLAB 2022b offline i am facing this issue as file attached below , please help me out.

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by