If statement for a cell??
Afficher commentaires plus anciens
I am trying to see if a column in a cell has string matching to what I stipulate.
I have read info on cells and still can not understand how to get this to return an answer.
The cell has integers 1:4 for the first column, then strings for the next column, then numerical values for rows 3 and 4.
I.e.
Point_list=
{'Point',1,2,3,4;'Type','Fixed','Unfixed','Unfixed','Unfixed';'X',800.000,120.000,2400.000,7210.000;'Y',60.000,700.000,1630.000,6320.000}
What I am trying to achieve:
If the string states 'Fixed' then return value 7
else return value 15.
Code I am using:
v(1,1) = zeros
if Points_list {:,2} strcmp(:,'Fixed')
v(1,1) = 7
else
v(1,1) = 15
end
What is the easiest way to get what I would like?
Thanks.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!