dc motor to arduino uno/ NO ADAFRUIT OR MKR

Hello, I am having trouble with my dc motor connected to arduino uno. im using matlab but nothing i try is working. Does anyone have any tips?

this is my matlab code but everytime i run it, it gives me an error. I just need it to spin.


while true

error message
Attempt to execute SCRIPT dcmotor as a function:

Error in dcmotor (line 3)

nothing i try is working

That is a very poor description of a problem.

it gives me an error.

It would be much easier to help you with the error if you let us know what it is.

Read the how to use this forum-please read sticky to see how to properly post code and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.