Error Using Serial/fprintf Line 144
Contents |
Support Answers MathWorks Search MathWorks.com MathWorks Answers Support MATLAB Answers™ MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange read serial matlab ThingSpeak Anniversary Home Ask Answer Browse More Contributors Recent Activity Flagged Content
Matlab Write To Serial Port
Flagged as Spam Help MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak fwrite serial matlab example Anniversary Home Ask Answer Browse More Contributors Recent Activity Flagged Content Flagged as Spam Help Trial software Walter Roberson (view profile) 27 questions 27,551 answers 9,623 accepted answers Reputation:
%g In Matlab
49,797 Vote0 serial/fprintf of non-string? Asked by Walter Roberson Walter Roberson (view profile) 27 questions 27,551 answers 9,623 accepted answers Reputation: 49,797 on 3 May 2015 Latest activity Edited by Walter Roberson Walter Roberson (view profile) 27 questions 27,551 answers 9,623 accepted answers Reputation: 49,797 on 3 Jul 2015 Accepted Answer by Nalini Vishnoi Nalini Vishnoi (view profile) fwrite matlab serial 0 questions 38 answers 15 accepted answers Reputation: 80 29 views (last 30 days) 29 views (last 30 days) The documentation of serial/fprintf shows four possible modes in the representative forms, and in each case the data to be sent is shown as a string. However, the format parameter can include any of many different non-character item specifiers, and one of the examples isfprintf(s,['ch:%d scale:%d'],[1 20e-3],'sync'); which demonstrates a case where the data to be sent is not a string.Despite this, a user is reporting to me that in R2013a that they were toldError using serial/fprintf (line 84) The third input argument must be a string. Error in Untitled (line 10) fprintf(s, '*%d', data(:)) ; where data is uint8 (obtained via imread)Unfortunately I cannot test this on my own system as I do not have a serial port. Could someone confirm that non-string data can be used in serial fprintf, and could they test whether uint8 is the problem?(Assume for the moment that the serial buffer is large enough to hold the entire o
Support Support Newsreader MathWorks Search MathWorks.com MathWorks Newsreader Support MATLAB Newsgroup MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak Anniversary Home Post A New Message Advanced Search Help
Serial Port Matlab
MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange
How To Receive Data From Serial Port In Matlab
ThingSpeak Anniversary Home Post A New Message Advanced Search Help Trial software RS-232 problems Subject: RS-232 problems From: Konstantin Konstantin (view matlab to arduino serial communication profile) 0 posts Date: 28 Dec, 2010 11:05:22 Message: 1 of 9 Reply to this message Add author to My Watch List View original format Flag as spam Good afternoon. I apologize if I https://www.mathworks.com/matlabcentral/answers/214786-serial-fprintf-of-non-string created the theme is not there I'm going to use Matlab to test my FPGA-project of Vietrbi-Decoder. On my dev-kit there is USB->RS232 chip, on PC there is drivers for virtual com-port.COM Port working Ok, I tried to send through it the information from other programs - everything is fine Now I want use Instrumental Toolbox , making all the instructions >> s = serial('COM1'); >> fopen(s) >> https://www.mathworks.com/matlabcentral/newsreader/view_thread/299738 fprintf(s,'ABCD') Then a strange happens On oscilloscope i see all timing diagrams - four bytes (A-B-C-D), then byte of carriage return, BUT Matlab stops script with error ??? Error using ==> serial.fprintf at 144 An error occurred during writing. In what may be the problem? And I'm sorry for my english) Subject: RS-232 problems From: Trent Jarvi Trent Jarvi (view profile) 227 posts Date: 28 Dec, 2010 15:03:42 Message: 2 of 9 Reply to this message Add author to My Watch List View original format Flag as spam "Konstantin "
Topic last updated 03 Aug 2015, by Michael Kutzer. 16 replies Erik Olieman Sissors # 29 May 2012 I want to send and receive data between the mbed and matlab. https://developer.mbed.org/forum/helloworld/topic/3568/ That should not be a problem, just using the serial drivers (which are installed yes). So simple Matlab script: s1=serial('COM5'); fopen(s1); fprintf(s1, 'Bwah'); fclose(s1); On computer 1, windows Vista, that works fine. On computer 2, windows XP, it does not work. On computer 3, windows 7, it does not work. In both cases Matlab tells me: Error using serial/fprintf (line serial port 144) Unexpected Error: An error occurred during writing. A similar error happens when using fwrite instead. If I use TeraTerm it works fine. Now before you tell me to go to the Matlab forums, Matlab works fine if I write to another serial port. So the problem is really between Mbed and Matlab. The writing part also does occur, the error using serial/fprintf error happens after the (virtual) serial port gets its data. But with matlab programs exitting due to an error that does not really help me. Reading seems to be working normally. With some googling the only relevant information I could find was: Quote:To determine if the data has been written completely, the MATLAB serial object tries to flush the data out after writing. Some older USB->RS232 drivers do not properly support this operation resulting in an error. Make sure that you have the latest driver from the vendor of your USB->RS232 dongle as these drivers have improved significantly in recent years.
Which is nice and all, but it does not explain why it works on computer #1, and it really doesnt help me with how to solve this. Also computer 2 and 3 have nothing in common (one is a home laptop, other one is work computer, also different matlab versions, but all pretty up to date). So has anyone encountered this before, and/or any clue how to fix this? Edit: Well I was already searching a whi