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

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by