Hi
I'm very new to Matlab…so thanks for your patience. I'm working with the hospital dataset that comes with Matlab (load hospital in Matlab). I want to create a new vector, say DummyGender by looking at the vector hospital.Sex. The rule is:
for x = 1:100; if hospital.Sex=='Male'; gender{x}=1; else gender{x}=-1; endend
this works, but I need to go ahead and transpose it, and then convert it to a numerical variable and then finally add it as another column in the dataset. Is there a more efficient way to do the same?
thanks C
Best Answer