How can I import a signal extracting function in a Simulink 'From Workspace'-block?
3 views (last 30 days)
Show older comments
Commented: Pascal Mousel on 3 Jun 2015
I'm working on a project where I have to import a signal to Simulink. I first need to build the Signal from a ".mat" file (here called "data"), this file contains two sets of values and two sets of times. For the purpose of extracting and creating a signal (here "s"), I created this little function ("fkt").
function [ s ] = fkt()
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
samples= 100000:105000 ;
t = [data1_time(samples)]';
s.signals.values = x;
s.signals.dimensions =2 ;
I used it as "Data" parameter for a 'From Workspace'-block in Simulink and connected it to a scope, to have a look at the signal I get. But I get the block error:
*Invalid setting in 'Project/From Workspace' for parameter 'VariableName'.
Error evaluating parameter 'VariableName' in 'Project/From Workspace'
Undefined variable "fkt" or class "fkt.m".*
What am I doing wrong? I tried some stuff but I'm not getting where my mistake is. :-(
Thank you in advance :)
Ilham Hardy on 3 Jun 2015
The From Workspace block looks for Data (s) instead of script (fkt.m).
What happen if you put s instead if fkt/fkt.m in the Data parameter?
Find more on Signal Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!