From the Super Mario Wiki
The Yellow Switch is one of four colored switches that appeared in Super Mario World. Activating this switch will turn all yellow outlined blocks into solid yellow ! blocks. Each yellow ! block contains a Super Mushroom, regardless of Mario's power-up.
Yellow Switches are also found in the Vim Factory during Mario & Luigi: Partners in Time. Around two to three appear in the game. They have two squares on them, meaning that both Baby Mario and Baby Luigi must stand on the switch to open a door. They are a variation of the common Blue Switch.