how to operate on rows and columns of a matrix variable generated from SIMULINK output, using SIMULINK blocks?

8 views (last 30 days)
hi, i have been using the combination of MATLAB program and SIMULINK model for may project. but this will serve my purpose only if i work on offline data. i have been generating the data from the simulink model, saving to workspace and then processing the data (rearrange it to make it suitable to feed to ANN as input.)using matlab program(.m). now i want to avoid the necessity of the program by including suitable simulink blocks in my model. the program i have been using is given below.
load scopedata1
ScopeData1(:,1)=[]; %removes 1st column(time line) as i dont need it.
for x=1:305
for x=1:305
for x=1:305
save Normal_48 h
this is the code i have been using to rearrange the data stored in "ScopeData1" (size 321*4)in workspace by the simulink scope, in to another variable "h" (size 48*306). each column of "h" is combination of 3 sets of 16 data points, each set taken from taken from 16 data pints of last 3 columns of "scopedata1" in moving window format (i.e 1to 16, next 2 to on).
now my question is how to do all this in simulink model itself? without using any program. because i have to work on dynamic data which is being continuously fed to the system through data acquisition card. and i dont know how to switch between model simulation and program (if there is a way) continuously. moreover switching will increase the operation time, which i dont want.

Answers (1)

Arnaud Miege
Arnaud Miege on 14 Jun 2011
Probably through a combination of Selector and Matrix Concatenate blocks, although it might be easier to use a MATLAB Function block (previously called Embedded MATLAB Function) to re-use your existing MATLAB code. This may require you to rework your code slightly.
  1 Comment
Harish Balaga
Harish Balaga on 29 Jun 2011
thank you for the answer sir, but the matrix concatenate block is generating a 3-D matrix instead of a 2-D matrix when i concatenate two 2-D matrices and send the result to "toworkspace" or "to file" block. what shall i do?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by