If statement using Char class variable
Ältere Kommentare anzeigen
Hi there! I have had a cell class variable text3 size 1X2 containg '11-03'. I used the cell2mat function to convert this variable to char class variable cause I want to use an IF statement however the size of the variable remains 1X2. Below is an example of what I am looking to do:
text3 = { '11-05', '' , '' , '' ;
'' 'X' 'Y' 'Contact Size';
'A' '' '' '' ;
'B' '' '' '' ;
'C' '' '' '';
'D' '' '' '' ;
'E' '' '' '' };
[matchobj strsplit] = regexp(text3,'11','match','split');
A = cell2mat(matchobj{1:1});
if A < 15
P = 6;
else
P = 5;
end
Any one have any ideas as to what I can do to fix this ? Everything compiles.
1 Kommentar
Diego Tasso
am 19 Jun. 2012
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Data Type Conversion finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!