Matlab Unity Communication

  Рет қаралды 12,728

Ivan Camponogara

Ivan Camponogara

Күн бұрын

Пікірлер: 52
@miz3567
@miz3567 3 жыл бұрын
OMG Thank you !!!!! Lifesaver!!!
@alex972011
@alex972011 3 жыл бұрын
How did you manage it in the latests Matlab versions?
@miz3567
@miz3567 3 жыл бұрын
@@alex972011 My Matlab version is R2016b, it works fine with this code.
@mohamedrizk4658
@mohamedrizk4658 4 жыл бұрын
you are a lifesaver
@ivancamponogara6578
@ivancamponogara6578 4 жыл бұрын
Thanks Mohamed! I’m glad you found the tutorial useful 😊 the only thing I couldn’t figure out is how to reduce the delay, just let me know if il you have some tips for it.
@mohamedrizk4658
@mohamedrizk4658 4 жыл бұрын
@@ivancamponogara6578 in c# you open a tcp port which is one end of the port(pipe) .when you open the pory in matlab you open the other end; then unity freeze to receive data meanwhile matlab start to send data in the port and then close the pipe. closing the port signal to c# you have received all data[ reader.readtoend();] and it can progress in code. keep in mind opening the port and closing it (to approve you have send all data) take along time .3 s what should happens is that, c# should have a buffer with a fixed size (the size of string of data); and you should not close the pipe. but you should stream the data continues from matlab ,and c# should wait until its fixed size buffer become fill then it continue it process and all other data that matlab send it will be stored in the pipe waiting for c# to call read again how to do that in c# i have no idea
@ivancamponogara6578
@ivancamponogara6578 4 жыл бұрын
Super thanks! I'll work on it and let you know if I have some news!
@lsx1404
@lsx1404 4 жыл бұрын
hello,can you share your c# code?
@zhenisotarbay5159
@zhenisotarbay5159 Жыл бұрын
Installed Psychtoolbox-3, but still: Error using KbName (line 861) Key name "ESCAPE" not recognized. Maybe you need to add KbName('UnifyKeyNames'); to top of your script? Error in Code_Moving_Cylinder_with_arrows (line 7) escapeKey = KbName('ESCAPE');
@huangzheng6580
@huangzheng6580 Жыл бұрын
Did you fix it? I want to use Psychtoolbox-3 to present picture arrays and send markers to EEG devices, I do not know whether I can do it
@huangzheng6580
@huangzheng6580 Жыл бұрын
thank you a lot, It works! However, there is an issue with delays. As I press a key(for example, a left key), it wont move immediately, it will delay for seconds and then move, how to solve this problem?
@ivancamponogara6578
@ivancamponogara6578 Жыл бұрын
Hi Huang, yes, that was the central issue. If you find a way to solve it, let me know!
@ahmadyounis7537
@ahmadyounis7537 5 жыл бұрын
Hello thanks for you important information. would you please tell us how to model this work(tcp) to send data using simulink.
@ivancamponogara6578
@ivancamponogara6578 5 жыл бұрын
HI Ahmad, unfortunately I have no idea. You might find something around youtube.
@zhenisotarbay5159
@zhenisotarbay5159 Жыл бұрын
Which matlab version did you use?
@arunsebastian2825
@arunsebastian2825 2 жыл бұрын
Hi , How can I play and stop a video in Unity using MATLAB? (I'm new to Unity). Thanks
@ivancamponogara6578
@ivancamponogara6578 2 жыл бұрын
You should try merging this docs.unity3d.com/Manual/class-VideoPlayer.html with this stackoverflow.com/questions/41562023/how-to-play-video-in-unity-2d and something in Matlab like this www.mathworks.com/matlabcentral/answers/154565-how-do-i-stop-or-pause-a-video-in-matlab-gui-activex-windows-media-player best of luck for the project!
@chewchew99
@chewchew99 Жыл бұрын
Hi Ivan, great video! I followed all instructions but I am still unable to command the cylinder in Unity to move. It feels like the connection between MATLAB and Unity is not established. Any idea on how to fix it?
@ivancamponogara6578
@ivancamponogara6578 Жыл бұрын
Hi! Sorry for the late reply. It looks like a problem related to the client setting (line 6 Matlab code, tcpipClient command). Try to figure out which client you should use. It may be that since 2019 Matlab has also changed some commands. I have never used this code since then, so I don't know if Matworks changed some settings of the tcpipClient command. Hope this somehow helps!
@chewchew99
@chewchew99 Жыл бұрын
@@ivancamponogara6578 Thanks a lot!
@mariaandreasanchezcifuente4743
@mariaandreasanchezcifuente4743 3 жыл бұрын
you should explain how to make the connection step by step the video is good but sometimes it loses
@Thomse100
@Thomse100 3 жыл бұрын
Hello Ivan Camponogara. Is it also possible to build an application for Android devices with the method shown, or is the method only accessible for the Unity Editor?
@ivancamponogara6578
@ivancamponogara6578 3 жыл бұрын
Hi! What kind of app you have in your mind? It is not clear to me what would be the main function of the app
@Thomse100
@Thomse100 3 жыл бұрын
@@ivancamponogara6578 I am planning a thesis in the form of simulation software for the Oculus Quest. The Oculus Quest runs on the operating system: Android. Therefore, I wanted to use Matlab for the calculations and Unity for the visualization, if that is possible.
@ivancamponogara6578
@ivancamponogara6578 3 жыл бұрын
@@Thomse100 I never tried it with the Oculus quest, but I think that if you want to use this method on the oculus, you will have to attach the quest on a computer and feed the oculus with real time data coming from Unity, which, in turn, receives real time data from Matlab. I don't think you can make a standalone app where Matlab is making the calculation, and upload it into the oculus. Matlab and Unity are two different softwares, so they need to be installed in the same device to work together. In other words, you can use the Oculus as "display" while it's attached to your computer. Does it make sense?
@Thomse100
@Thomse100 3 жыл бұрын
@@ivancamponogara6578 I understand. I also guess that the Oculus Quest cannot compile Matlab applications. Thanks for the quick feedback.
@ivancamponogara6578
@ivancamponogara6578 3 жыл бұрын
@@Thomse100 no problem! Maybe there is a way via C# to feed some oculus data in real time to the unity based app and make the calculations, but I’m not sure. Moreover I don’t know what will be the computational time of the oculus, since it will be busy rendering the environment
@haoxinwu1336
@haoxinwu1336 4 жыл бұрын
Hello thank you so much,I want to know could unity&matlab Implement function:I wrote a piece of matlab code in text format in unity,and send it to matlab,then use matlab compile it?(sorry ,my English is limited)
@ivancamponogara6578
@ivancamponogara6578 4 жыл бұрын
Yes,but if you want to send commands from unity to matlab then you have to reverse the communication.in my video,matlab send commands to unity.in your case you want unity to send commands to matlab.therefore,you have to switch the communication between them and make matlab “listen” to unity. You can do it by changing the “client” and “server” functions in the codes. You can find some tips here www.mathworks.com/matlabcentral/answers/196774-connection-between-matlab-and-unity3d
@haoxinwu1336
@haoxinwu1336 4 жыл бұрын
@@ivancamponogara6578 ok ,thank you very much
@haoxinwu1336
@haoxinwu1336 4 жыл бұрын
could i know your email address?i have some questions about unity and matlab
@faisal2206
@faisal2206 5 жыл бұрын
Place your can programe fuzzy logic control BMP180 with arduino to matlab ??
@ivancamponogara6578
@ivancamponogara6578 5 жыл бұрын
Faisal I have no idea of what you are talking about
@mrkimo1997
@mrkimo1997 4 жыл бұрын
Hello, thank you so much for this tutorial but there is a problem with the connection as following: Error using icinterface/fopen (line 83) Unsuccessful open: Connection refused I have checked that my firewall allows this connection and that port 55001 is open through telnet in cmd, I have also double checked the code, so is there something I'm missing ?
@ivancamponogara6578
@ivancamponogara6578 4 жыл бұрын
Hi Karim! Have you checked also the c# script?
@mrkimo1997
@mrkimo1997 4 жыл бұрын
@@ivancamponogara6578 yes I did, I triple checked again now and even compared with the video and the downloaded files.. the communication codes seems fine to me.
@ivancamponogara6578
@ivancamponogara6578 4 жыл бұрын
Which o.s. are you using? Matlab version?
@mrkimo1997
@mrkimo1997 4 жыл бұрын
@@ivancamponogara6578 Windows 10 pro x64 and Matlab version is R2018a
@ivancamponogara6578
@ivancamponogara6578 4 жыл бұрын
Could this answer help ? www.mathworks.com/matlabcentral/answers/41455-how-do-use-fopen-properly-everytime-i-try-i-recieve-an-error
@zhenisotarbay5159
@zhenisotarbay5159 Жыл бұрын
Hello, could you please share s charp code not rtf?
@ivancamponogara6578
@ivancamponogara6578 Жыл бұрын
Isn't it just a matter of copying and pasting the code into the Unity editor?
@perizatinirbaeva507
@perizatinirbaeva507 Жыл бұрын
@@ivancamponogara6578 it has some garbage which is not related to c sharp code like /u3829ndjej
@ivancamponogara6578
@ivancamponogara6578 Жыл бұрын
@@perizatinirbaeva507 If I download the file and open it with a text editor, I can see the code without the rubbish you are referring to. If I then copy and paste the content from the text file to C sharp, I can't see any rubbish on the code.
@zhenisotarbay5159
@zhenisotarbay5159 Жыл бұрын
Kbname not defined
@ivancamponogara6578
@ivancamponogara6578 Жыл бұрын
You should download the psychtoolbox in Matlab. If you type "kbname matlab" on google you will be redirected here psychtoolbox.org/docs/KbName They may have changed something in the years, and kbname may have changed in something else. Just have a check.
@tunna4766
@tunna4766 4 ай бұрын
What is that ?????????????? Pick a language
Simulating Quadcopter Missions with Simulink and ROS
18:27
Ardity - free plugin for connecting Arduino & Unity
7:40
GSA School of Innovation and Technology
Рет қаралды 6 М.
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 21 МЛН
An Unknown Ending💪
00:49
ISSEI / いっせい
Рет қаралды 52 МЛН
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 1,1 МЛН
отомстил?
00:56
История одного вокалиста
Рет қаралды 7 МЛН
EEG data and indexing in Matlab
20:23
Mike X Cohen
Рет қаралды 27 М.
Matlab Unity Image Transfer
9:48
Ivan Kholodilin
Рет қаралды 351
Prespective Tutorial: Integrating MATLAB/Simulink into Unity with Prespective
33:10
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
AI can't cross this line and we don't know why.
24:07
Welch Labs
Рет қаралды 777 М.
I Made The Ultimate Cheating Device
9:39
ChromaLock
Рет қаралды 952 М.
Send data to Arduino from Matlab
5:12
Ivan Camponogara
Рет қаралды 21 М.
Unity3D GameDev Interview Questions
34:47
Jason Weimann
Рет қаралды 54 М.
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 21 МЛН