Apply cell fun specifying a particular condition of the applied function to my cell

2 ビュー (過去 30 日間)
Bio_Ing_Sapienza
Bio_Ing_Sapienza 2018 年 12 月 8 日
回答済み: Jan 2018 年 12 月 9 日
Hi everyone.
clear all
close all
clc
[Header,Sequence]=fastaread('D:\Bioinformatica\Tesi\Codici Python\PfalciparumAnnotatedProteins_lc.txt');
Counter=cell(numel(Sequence),1);
for i=1:numel(Sequence)
Counter{i,1}=isstrprop(Sequence{i,1},'lower'));
end
Seeing that as always Matlab is giving me the error 'Index exceeds array bounds" as error i've decide to change approach. Is it possible to apply a function by cell fun with a specified string command?
In particular i'd like to apply
'lower'
to
isstrprop
at each element of my cell array
thank you in advance

回答 (1 件)

Jan
Jan 2018 年 12 月 9 日
"Index exceeds array bounds" seems to be very easy to fix. Find out, which index is concerned. Perhaps Sequence is a cell array, not a vector. Then simply change:
Counter{i, 1} = isstrprop(Sequence{i, 1}, 'lower'));
to
Counter{i, 1} = isstrprop(Sequence{i}, 'lower'));
% ^^^ linear indexing

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by