What is the matlab code syntax to create a temporary array in MATLAB ?

5 visualizaciones (últimos 30 días)
I am working on the fault detection and fault classification in power system using wavelet and ANN in matlab/simulink. I need to sense the fault current from the power system model drawn in simulink, and the waveform of the fault current displayed in the scope will be converted into data and has to be stored temporarily in the form of array in workspace (as a memory) and this data samples stored in the array shall be fed to wavelet code (along with 0.05 sec time step, so that window can be made) and the wavelet code can calculate the fault coefficients and these fault coefficients can be fed to the ANN controller to detect the correct type of fault. Once the data samples is fed to the wavelet code after 0.05 sec, that data samples stored in array will be cleared and new data samples will be stored in the form of array in workspace. Again this data samples is fed to wavelet code and wavelet code will calculate the fault coefficients and after next 0.05 sec the data samples stored in the array will be cleared and new data samples will be stored in the array in workspace. In this way at every 0.05 sec time step, the data samples will be stored in the array and will be given to wavelet code and the array will be cleared and new data samples will be stored in the array. This array is called "temporary array".
The question is that how to create this temporary array in MATLAB ? What is the matlab code syntax for creating this temporary array ? I just want only suggestion. I am not asking for an exact answer.
  1 comentario
dpb
dpb el 9 de Jun. de 2022
tmp=zeros(N,1);
creates a column vector of N elements you can write into...it will have to be in scope of whatever it is that is doing the calculation or be global.

Iniciar sesión para comentar.

Respuestas (1)

Ganesh Gudipati
Ganesh Gudipati el 13 de Jun. de 2022
Hi Siddharth,
As per my understanding you want to create an array and at each timestep the new samples should replace the old samples.
Create a array of initial size ‘n’ using the command
tempArray = zeros(1,n);
% no of rows =1, now of columns = n;
Let us consider your model as a function. Now this function takes the tempArray and it will modify the array at each time step.
Once this whole execution is done, and the tempArray is no more required
clear(tempArray)
%This removes the array from the workspace and frees the memory.
For more information refer Matrices and Arrays

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by