I haven't MATLAB and CE60246, however
I was considering something in program of PSoC.
 You can see received data by using JTAG or SWD debugger.
What was received data?
... /* Wait for input data from PC */
... while(USBUART_1_DataIsReady() == 0u);
... <--- CHECK DATA HERE
 I think, this code is suspicious
... sprintf((char *)wrBuffer, "The ADC_0 channel(%d) is: 0x%4x \n\r\n\r", <--- this ONE
... (int)rdValue, adcReading);
... PrintToUSBUART((char8 *)wrBuffer);
On the Matlab side, will receive two lines.
If so, Is Matlib work correctly?
This might be out of point, I'm not sure.
Hi PSoC73, Thanks for replying, and for the pointer. I had not considered SWD and do not have a miniprog at my disposal. The code you cite works on a puTTy-type terminal, pointing to the COM port connected to the PSoC. However, I have not been able to send a piece of data from matlab using fwrite. That said, the complementary function, fread, works fine, so long as the data to be read is transmitted repeatedly by PSoC.
I don know why you couldnt SWD debugging.
What program cable did you use?
Anyway, you need to isolate the problem.
if had no debugger, you can check it LED debug.
Put TestPin_write(0) and TestPin_write(1)
before test point and after test point.
If you do not have a PSOC board for debugging, you can always create a simple
UART link to PC and pass debug info over that, like variable values, port and pin states,
etc. You can get a UART example project by right clicking unselected UART component,
and picking "Find example project". You can add that to you workspace of open in a new
workspace and cut and paste to your target workspace.
can anyone help me whether matlab will generate a c code automatically for psoc controller?