Why doesn't this matlab code work?!
Ältere Kommentare anzeigen
s={'CCCAGCTCCCGAATTCCCCAGCTA'};
rec={'AG^CT'};
x=strfind(rec,'^');
y=rec;
y(x)=[]
I get:
Error using subsindex Function 'subsindex' is not defined for values of class 'cell'.
Error in Untitled555555 (line 5) y(x)=[]
Akzeptierte Antwort
Weitere Antworten (3)
Image Analyst
am 3 Jan. 2015
then try this:
rec={'AG^CT'};
x=strfind(char(rec),'^')
y=rec
y{1}(x)=[]
Ahmad
am 3 Jan. 2015
0 Stimmen
1 Kommentar
Image Analyst
am 3 Jan. 2015
Your error doesn't match your code. In the strfind, do you have y or {y} ? And if it's {y}, then why???
Say, did you ever look at the FAQ link I gave you? Please do. I gave it to you because I think it will help you understand cell arrays. If you can't understand the FAQ, let me know and I'll clarify it.
Ahmad
am 3 Jan. 2015
0 Stimmen
1 Kommentar
Image Analyst
am 3 Jan. 2015
Not sure you do understand cells yet because you'd know that y{1} means "contents of the first cell of y". So y is a cell or a cell array (a columns or row vectors). Then 1 means take the first cell in the row, or first cell in the column, and get the contents of it, which could be virtually anything - a string, a structure, a double, an image, even another cell. In your case y is a cell array where the cells contain strings, so y{1} is a string.
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!