The cause of sudden wheezing can be caused by a virus or viral infection and should resolve itself within a week or two.
But if the wheezing continues to happen after a week or two or seems to get worse then it's best to see a doctor to make sure you don't have a more serious problem such as a lung condition or lung infection.
Also if you do not have asthma or a history of asthma or the wheezing is accompanied by a fever of 101° or above; you may have a respiratory infection such as acute bronchitis, sinusitis, or pneumonia.
In that case you need to see a doctor or go to either the emergency room or urgent care to make sure the wheezing is nothing more serious.