In all of the provided sentences, "fui" means "I was." However, the direct context differs as follows:
- Fui al médico. - I went to the doctor.
- Fui a Madrid. - I went to Madrid.
- Fui estudiante. - I was a student.
- Fui ayer. - I was (there) yesterday.
So, while "fui" indeed translates to "I was" in the sentence "Fui estudiante," it also means "I went" in the other contexts. The clear instance where "fui" strictly means "I was" is in "Fui estudiante."