[IMPORTANT] How to connect Arduino and Matlab?

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.

What is especially IMPORTANT about your problem?

This seems to me to be a Matlab problem and if it was my problem I would be consulting a Matlab forum.

...R

Robin2:
What is especially IMPORTANT about your problem?

This seems to me to be a Matlab problem and if it was my problem I would be consulting a Matlab forum.

...R

Haven't I mentioned that I need help in importing text from a .txt file and opening it in Arduino?
Isn't that quite related to Arduino? or if you have a bit of knowledge would you like to share it with me?
Is there any possible way that I can read a text from a txt file or at least add the txt file from my computer to Arduino SD card?

Thanks in advance.
And it is IMPORTANT for sure since I have a presentation in a university in 3 days.

The error you posted in your Original Post is not an Arduino error

Open failed: Port: COM7 is not available

It is a PC/Matlab error.

And it is IMPORTANT for sure since I have a presentation in a university in 3 days.

Perhaps you meant to say "Urgent" - if you are at university I would expect you to know the difference

But it is not our problem that you left it so late to figure out a solution. And your question is no more (or less) important than any other question here.

...R

Robin2:
The error you posted in your Original Post is not an Arduino errorIt is a PC/Matlab error.
Perhaps you meant to say "Urgent" - if you are at university I would expect you to know the difference

But it is not our problem that you left it so late to figure out a solution. And your question is no more (or less) important than any other question here.

...R

Aren't you intending to help or perhaps you know nothing about this?

I'm not in university I'm a highschool student who had to make a project and learn "uni subjects" by my own in order to present it in the university.

And in fact, I haven't left anything so late since I was busy writing an algorithm in matlab and eventually had to connect matlab to my application via arduino.

Urgent or important it is still a question that needs to be answered.

jisparrow:
perhaps you know nothing about this?

You are quite right. I don't know Matlab, or Windows for that matter.

I have been trying (with complete lack of success) to suggest that you ask your question where you are more likely to meet someone that knows Matlab.

...R

Robin2:
You are quite right. I don't know Matlab, or Windows for that matter.

I have been trying (with complete lack of success) to suggest that you ask your question where you are more likely to meet someone that knows Matlab.

...R

Mate, if my problem wasn't also related to arduino I wouldn't even think about posting it here..
But you see, I know that Arduino has a function called SD.open().. in order to open a text file from the SD card I have to put the file inside it first, and this text file has the results that are coming out from Matlab, so I was trying to reach the Arduino SD card directly from Matlab itself... or at least, save the result in a text file and then save the text file inside the SD card, I swear to god google is sick of me because of how much I've looked for an answer... It is a real urgent case I need an immediate help.. otherwise my future will be over... :confused:

Is there some particular reason that Matlab has to write to a SD card on an Arduino shield?

Isn't writing to an SD card on the PC running the Matlab enough?

ieee488:
Is there some particular reason that Matlab has to write to a SD card on an Arduino shield?

Isn't writing to an SD card on the PC running the Matlab enough?

No it is not, you see, I used Arduino SD card in order to connect arduino to my application via Bluetooth...
This is the idea in general, I take the results from Matlab in a text file, then put the text file in Arduino SD card, then open the text file using SD.open(), read the results and send them to the application via Bluetooth HC-06. I already solved the bluetooth connection, but all I need is to know how to get the results and read them.. I'd be glad if anyone helped me, It'd save my life really...

(deleted)

spycatcher2k:
If you want the code to do this, then feel free to ask for someone to write this for you (Though you may find that you will be parting with some cash) - If you need help, post the code you have attempted so far, and you may find that we are more likely to help polite people.

We help because we want to, not because you demand it.

For the love of god batman! I'm not asking for a damned code, I know how to code ..
I only needed to figure out if it is a possible way to whether read a text file in arduino that has been moved to arduino SD card OR a way that Matlab can directly write the file using fwrite!

I've been seraching everywhere! If you don't have an answer then simply don't comment...
Besides, this is a quite weird response from Batman since he's my superhero ;-;

jisparrow:
No it is not, you see, I used Arduino SD card in order to connect arduino to my application via Bluetooth...
This is the idea in general, I take the results from Matlab in a text file, then put the text file in Arduino SD card, then open the text file using SD.open(), read the results and send them to the application via Bluetooth HC-06. I already solved the bluetooth connection, but all I need is to know how to get the results and read them.. I'd be glad if anyone helped me, It'd save my life really...

That explanation still leaves me baffled.
I take the results from Matlab in a text file. HUH? How? With what?
put the text file in Arduino SD card Arduino does this?
open the text file using SD.open(), read the results and send them to the application via Bluetooth HC-06 Arduino does this? what application are you talking about?

.
.

EDIT:
Do you have the Matlab support package installed?

.

jisparrow:
so I was trying to reach the Arduino SD card directly from Matlab itself.

You can't reach an SD Card on an Arduino directly from Matlab. You need to get Matlab to send data to an Arduino program and then the Arduino program will write the data on the SD Card.

I had assumed from my very first reply that you understood that.

And I come back, yet again, to the error message in your Original Reply in which it appears that Matlab could not find the COM port that your Arduino is connected to. At no stage since then have you said that that problem was solved or that it was no longer relevant.

If Matlab has a problem finding the COM port that your Arduino is connected to that seems to me to be a Matlab problem. I assume you have no difficulty connecting to the Arduino using the Arduino IDE.

...R