Filter löschen
Filter löschen

Hello, I receive this error

1 Ansicht (letzte 30 Tage)
Antonis Marinou
Antonis Marinou am 11 Okt. 2017
Kommentiert: Antonis Marinou am 11 Okt. 2017
Hello, I have a folder and i have inside two m files and three .xlsx excel files. My first code 'Graph_Preprocessing_and_Visualization' works fine. Now, i want with some way to run my first script as a function in my second code 'Simulink_Configuration_Model'. My function in the second code has the same name with my first code. Here is my code:
set(0,'RecursionLimit',2000)
clear
close_system
clc
%%%Open simulink model
fic1='filname'
new_system('filname')
open_system('filname')
%%%Set Graph_Preprocessing_and_Visualization function parameters
bus_filename='Buscoords.xlsx';
lines_filename='Lines.xlsx';
loads_filename='Loads.xlsx';
Visualization_flag=1;
% Generate the new reduced system
[Bus_final,lines_final,line_type,Adjacency_matrix]=Graph_Preprocessing_and_Visualization(bus_filename,lines_filename,loads_filename,Visualization_flag)
A_ini=Bus_final; %%%Bus Final
Lines=lines_final(:,1:2) %%%Lines Final only the connections without the length
Here is my error:
Attempt to execute SCRIPT
Graph_Preprocessing_and_Visualization as a
function:
C:\Users\user\Desktop\mtlb\bin\New
folder2\Graph_Preprocessing_and_Visualization.m
Error in Simulink_Model_Configuration
<<>>
(line 16)
[Bus_final,lines_final,line_type,Adjacency_matrix]=Graph_Preprocessing_and_Visualization(bus_filename,lines_filename,loads_filename,Visualization_flag)

Akzeptierte Antwort

GEEVARGHESE TITUS
GEEVARGHESE TITUS am 11 Okt. 2017
When the problem is because ofexecuting the line [Bus_final,lines_final,line_type,Adjacency_matrix]=Graph_Preprocessing_and_Visualization(bus_filename,lines_filename,loads_filename,Visualization_flag)
It seems you have not defined the function Graph_Preprocessing_and_Visualization prior.
  3 Kommentare
Walter Roberson
Walter Roberson am 11 Okt. 2017
You do already have
C:\Users\user\Desktop\mtlb\bin\New folder2\Graph_Preprocessing_and_Visualization.m
on your path, but it is not coded as a function file.
You should check whether C:\Users\user\Desktop\mtlb\bin\New folder2\Graph_Preprocessing_and_Visualization.m happens to be on your path by accident, or whether it is some junk file that you can delete, or if you accidentally tried to use the same name Graph_Preprocessing_and_Visualization for two different purposes
Antonis Marinou
Antonis Marinou am 11 Okt. 2017
Thank you very much, you are absolutely right, i did not coded my first code as a function. Now it is working! Thank you mr Walter Roberson

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Environment Customization finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by