Undefined function or variable error

1 回表示 (過去 30 日間)
Anirudh Bhaskar
Anirudh Bhaskar 2020 年 11 月 27 日
コメント済み: Anirudh Bhaskar 2020 年 11 月 27 日
I was trying to create a function to split a string and store it in an empty cell
% Getting our kmers
function kmerlist=get_kmers(seq,k)
kmerlist={};
for i=1:length(seq)-(k-1)
kmerlist{i}=seq(i:i+(k-1));
end
end
This is my code and when i run and try to use the function i get
>>seq = "TGCAGTTGCA";
>> k=3;
>> kmerlist=get_kmers(seq,k)
Undefined function or variable 'get_kmers'.
Is error in my code?

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 27 日
This usually means that MATLAB is not able to see the file get_kmers.m. MATLAB can only see a file if it is on its search path. If the file is placed in the current folder, you don't need to do anything. However, if it is some other folder, then you need to add that folder to MATLAB's path: https://www.mathworks.com/help/matlab/matlab_env/what-is-the-matlab-search-path.html
  1 件のコメント
Anirudh Bhaskar
Anirudh Bhaskar 2020 年 11 月 27 日
thanks i got it

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSoftware Development Tools についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by