Hello @saurabhkulkarni123
The .hex file can be generated from the .elf file, the result of the build process.
To obtain the hex file directly from MATLAB you shall first locate the .elf file and then to apply the powerpc-eabivle-objcopy.exe on the elf file.
Let's take particular example, of the gpio_mpc574x file.
1. Open the gpio_mpc574x_mbd_rtw generated folder as "current folder" in MATLAB.
2. Run the following command in MATLAB's command window:
dos(fullfile(mbd_find_mpc_root, 'tools\S32DS\build_tools\powerpc-eabivle-4_9\bin\powerpc-eabivle-objcopy.exe -O ihex gpio_mpc574x.elf gpio_mpc574x.hex'));

Hope this helps,
Marius