In matlab/simulink environment, Can we export the data stored in the form of cell array (saved in workspace) from matlab to simulink model ?

3 visualizaciones (últimos 30 días)
I am working on the fault detection and fault classification in electrical power system using wavelet and ANN in MATLAB/Simulink. I have already collected the data for the fault currents in the three phases and ground (A, B, C are the phase currents and G is the ground current) as well as the fault coefficients m, n, p, q for the respective three phases and ground, using wavelet transforms for all types of faults, and saved in the form of .mat file in workspace. Now I have to check in running mode, by sensing the fault current from the power system model, and feeding the fault current into the wavelet transform code and wavelet transform code should generate the fault coefficients which is given to the ANN controller and ANN controller should detect the type of fault in power system model, so for that I have to separate the fault current data at every time step of 0.05 sec and create windows and those windows will be fed to the power system model created in simulink, and the wavelet transform code will generate the fault coefficients for the corresponding fault currents and feed to the ANN controller and finally ANN controller will detect the type of fault (in binary format).
I have 100001X4 data matrix for fault current saved in the form of .mat file in workspace, I have separated the data matrix into 100 no. of 1000X4 matrix (100 nos. because I have to separate at every 0.05 sec time step) by writing the "mat2cell" command and created a cell array (a matrix which has 100 no. of 1000X4 sub matrices inside) and saved in .mat file format in the workspace. Is the logic which I have used here is correct or wrong ? Atleast give me some suggestion. (I am not asking for an exact answer).
If the above logic is correct, then can we export the data stored in the form of cell array (saved in workspace in the form of .mat file) from matlab to simulink model ? How to do that ? Atleast give me some suggestion. (I am not asking for an exact answer).
I was using "From workspace" block in simulink to export the cell array data saved in workspace (in the form of .mat file) to power system model in simulink, but after running the simulation, it is throwing the following error as :-
"Unsupported input format for From Workspace block 'wind_withTCSC014/From Workspace1'. Available formats are double non-complex matrix, a structure with or without time, or a structure with MATLAB timeseries as leaf nodes. All formats require the data to be finite (not Inf or NaN)."
I also tried to use "From Untitled.mat" block also to do the same but it is throwing error as :-
Simulink does not support loading the input data in file 'G.mat'.
For data saved using MAT file versions prior to 7.3, Simulink can
only load two-dimensional arrays consisting of one-dimensional,
double, noncomplex samples. To load data of any other type,
complexity or dimension, use a timeseries object and save the
file using MAT file version 7.3 or later. For example, use: 'save
file_name -v7.3 timeseries_object'.
Can anybody help me resolve the above issue, atleast give me some suggestion. (I am not asking for an exact answer).

Respuestas (1)

Shivang
Shivang el 5 de Oct. de 2023
Hi Siddharth,
I understand you're running into an issue while trying to import data into Simulink.
Instead of using a cell array, you can reshape your data matrix into a multidimensional array. This will give you 100 'pages' of elements, with each page consisting of a 1000x4 matrix. Refer to the documentation page for multidimensional arrays: https://www.mathworks.com/help/matlab/math/multidimensional-arrays.html
You can then create a timeseries object with this multidimensional array. The data for this object will be the variable representing the multidimensional array. You can also specify the sample times, which should be a vector of length 100. See the documentation for examples on how to create timeseries objects: https://www.mathworks.com/help/matlab/ref/timeseries.html#d126e1352530
You should now have a timeseries object in the workspace. This timeseries object can be brought into Simulink using the 'From Workspace' block. You shouldn't encounter any errors now.
Hope this helps!
Best, Shivang

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by