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 件のコメント

Jan
Jan 2022 年 5 月 31 日
編集済み: Jan 2022 年 5 月 31 日
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.
Cris LaPierre
Cris LaPierre 2022 年 5 月 31 日
I inserted line feeds to make it easier to read the code withough having to scroll
Kaviya Meena
Kaviya Meena 2022 年 5 月 31 日
My dataset is an excel dataset and the file name is 'cardiomyopathy_dataset.xlsx'. For this dataset i received the above error
Walter Roberson
Walter Roberson 2022 年 5 月 31 日
That's fine but the problem is the extra feature.m that you have.
Kaviya Meena
Kaviya Meena 2022 年 5 月 31 日
Yes, I am already having a matlab file named as feature.m....whether that is cause of this issue
Walter Roberson
Walter Roberson 2022 年 5 月 31 日
yes, I guarantee you that is the cause of the problem.

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2022 年 5 月 31 日

1 投票

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

9 件のコメント

Kaviya Meena
Kaviya Meena 2022 年 5 月 31 日
Thanks a lot for your timely help. I just solved the error
misha ariff
misha ariff 2022 年 6 月 19 日
how you solved this problem
Walter Roberson
Walter Roberson 2022 年 6 月 19 日
which -all feature
and tell us the first two lines of results
Ravpreet
Ravpreet 2022 年 12 月 21 日
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
Walter Roberson
Walter Roberson 2022 年 12 月 21 日
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.
Ravpreet
Ravpreet 2022 年 12 月 21 日
Yes you are right. I am using MATLAB online. Then what is the solution for it.
Walter Roberson
Walter Roberson 2022 年 12 月 21 日
You need to cd to the ompbox/private directory in MATLAB online, and give the command
!make
Ravpreet
Ravpreet 2022 年 12 月 22 日
A Big Thanks to you Sir! Thank you so much
Ravpreet
Ravpreet 2022 年 12 月 22 日
It works.

サインインしてコメントする。

その他の回答 (1 件)

vasanthkumar
vasanthkumar 2023 年 2 月 21 日

0 投票

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

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by