1

I'm trying to connect Maltab and Arduino by this code:

arduino=serial('COM7','BaudRate',9600);
fopen(arduino);

But I get this message:

Open failed: Port: COM7 is not available. No ports are available. Use INSTRFIND to determine if other instrument objects are connected to the requested device.

What might be a proper reason?

I have another question which is; How can I save a text file (.txt) from Matlab to Arduino SD card .. ? Wether opening a .txt file in arduino or saving it from Matlab directly to Arduino SD card.

  • 1
    when you open it and after forget to close it (lets say your script crashes) and retry to reopen it will cause these errors. Try force a fclose on serial object. – brtiberio Feb 18 '16 at 19:03
  • I've done this and it still gives the same message. Isn't there any other possible option maybe to add a text file to Arduino SD card or anything else? – Jack Sparrow Feb 18 '16 at 19:37
  • If you use arduino IDE, does it open the port normally? – brtiberio Feb 18 '16 at 20:36
  • Hmmm I currently have no time to order one since I have to finish my project in only 3 days .. You see, I got the results of my algorithm from Matlab in a .txt file, and what's left is to add this .txt file in Arduino SD card in a way or another... my first option was to add it directly from Matlab but the connection seems not quite supportive.. so is there any way to put this text file from my pc to Arduino SD card? Thanks in advance! You'd save my life :) – Jack Sparrow Feb 18 '16 at 20:45
  • Sorry but now you got me confused. You don't actually have an arduino (hardware)? When before I asked if the port opens correctly I was talking about arduino IDE (the software). I suppose a basic SD card reader connected to computer is out of question right? – brtiberio Feb 18 '16 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.