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 Comments

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.

Sign in to comment.

 Accepted Answer

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

9 Comments

Thanks a lot for your timely help. I just solved the error
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

Sign in to comment.

More Answers (1)

Hi, i am using MATLAB 2022b offline i am facing this issue as file attached below , please help me out.

Categories

Tags

Community Treasure Hunt

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

Start Hunting!