סקריפט מטלאב ו simulink

  • פותח הנושא BMWE
  • פורסם בתאריך

BMWE

New member
סקריפט מטלאב ו simulink

שלום! יש לי פונצקיה (סקריפט) מטלאב שאני רוצה שתופעל דרך simulink. הפונק' אמורה לדגום את הג'וייסטיק (שמחובר למחשב) ולהעביר את הנתונים שלו הלאה (3 נתנונים שמיד מופרדים דרך demux). הפונק':
funcrion data=Joystick ai=analoginput('joy',1); addchannel(ai,[1 2]); % % get data from the joystick % % d(1)=X, d(2)=Y % % data(1)=gas, data(2)=angle, data(3)=brake t0 = clock; while ((clock-t0) <20) d = getsample(ai); data(2)=atan(d(2)/d(1)); if (d(2) > 0) data(1)=d(2); data(3)=0; else data(3)=d(2); data(1)=0; end end​
השאלה היא איך אני מחבר אותה ל simulink (דרך איזה בלוק)? תודה
 

BMWE

New member
תוספת:

כאשר אני מריץ את זה (עם בלוק matlab func), אני מקבל את ההודעות הבאות:
1.Invalid setting for input port dimensions of Demux block 'teleopsim/Demux'. The dimensions are being set to 1. This is not valid because the input has fewer elements than the total number of output ports of this block 2.Error in port widths or dimensions. Output port 1 of block 'teleopsim/MATLAB Fcn' is a one dimensional vector with 1 elements​
הצעות?
 
למעלה