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

2 visualizaciones (últimos 30 días)
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

Respuestas (1)

Jan
Jan el 9 de Dic. de 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

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by