how to operate on rows and columns of a matrix variable generated from SIMULINK output, using SIMULINK blocks?
2 次查看(过去 30 天)
显示 更早的评论
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.
h1=ScopeData1(1:16,1);
h2=ScopeData1(1:16,2);
h3=ScopeData1(1:16,3);
for x=1:305
h1=horzcat(h1,ScopeData1(1+x:16+x,1));
end
for x=1:305
h2=horzcat(h2,ScopeData1(1+x:16+x,2));
end
for x=1:305
h3=horzcat(h3,ScopeData1(1+x:16+x,3));
end
h=vertcat(h1,h2,h3);
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 17...so 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.
0 个评论
回答(1 个)
Arnaud Miege
2011-6-14
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.
HTH,
Arnaud
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!