Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
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

Antworten (1)

Jan
Jan am 9 Dez. 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

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by