'Error in default port dimensions function of S-function', 'This function does not fully set the dimensions of output port 2'
23 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi there, I have created a manoeuvring prediction code and am trying to just read an excel document within the matlab function. The errors 'Error in default port dimensions function of S-function', 'This function does not fully set the dimensions of output port 2' come up when I try to do this. It works perfectly fine when I just input the coefficients and parameters in manually, but I want the user to just be able to use an excel sheet to put in their variables for this code.
Does anyone know how I can get this to work?
Sorry for the lack of knowledge, I'm not exactly a Matlab wizard.
Thanks in advance.
8 commentaires
Réponses (2)
Divya Gaddipati
le 12 Août 2019
In line 50 of your ManoeuvringCode.m, the variable X_u is defined as an expression which is present in your excel sheet in row 45 as well. When you are reading your excel file using xlsread, it is extracting that expression as NaN. Hence, your output port 2, which is v_dot is not defined properly as it depends on X_u, which could be NaN in some cases (u >= 0.1). Try defining X_u in the code itself and not from the excel.
8 commentaires
Walter Roberson
le 15 Août 2019
It just might help to use block parameters or an initial conditions block to initialize all the values that you GOTO into the function.
Voir également
Catégories
En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!