Effacer les filtres
Effacer les filtres

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

3 vues (au cours des 30 derniers jours)
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

Réponses (1)

Jan
Jan le 9 Déc 2018
"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

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by