Script of importing data not working with no warning or error
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
YASSER
el 2 de En. de 2024
Comentada: Star Strider
el 4 de En. de 2024
Hello
I am trying to import an excel data by using a ready script,
The problem is when i run it in editor it does not do anything!
and do not uppload the data
Where as when i change the script into a simple commande it works
No warning, no error !![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1580511/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1580511/image.jpeg)
0 comentarios
Respuesta aceptada
Star Strider
el 2 de En. de 2024
The function does not produce any outputs.
You will need to declare:
global ExperimentalIVData
in your calling script to get it to work.
However, I definitely do not suggest using global variables.
Change the script to return ‘ExperimentalIVData’ as an output instead, so the initial function declaration will be:
function ExperimentalIVData = LoadExperimentalIVData
and the problem solves itself. And delete all the global calls.
.
6 comentarios
Star Strider
el 4 de En. de 2024
As always, my pleasure!
I did not initially know that you wanted to import your spreadsheet data into Simulink.
Reviewing the R2020a documentation (that fortunately still exists), I was able to find the From Spreadsheet block that may be what you need to import your Excel data. I am otherwise not certain how to import your data into Simulink.
I have Simulink, however I rarely use it now, although I have used it extensively, most recently a couple decades ago. I have never needed to import spreadsheet data into it.
Más respuestas (1)
Dyuman Joshi
el 2 de En. de 2024
Editada: Dyuman Joshi
el 3 de En. de 2024
"The problem is when i run it in editor it does not do anything!"
Because there is no output defined for the function.
There are differences to how scripts and functions work - Scripts vs. Functions
You do not need to use global here. Remove that line and modify the function to provide the variable ExperimentalIVData as the output from the function.
0 comentarios
Ver también
Categorías
Más información sobre Data Import from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!