Path: news.mathworks.com!not-for-mail
From: Idin Motedayen-Aval <run.signature@MATLAB.for.email>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Using finite signals in Simulink
Date: Wed, 04 Nov 2009 18:02:09 -0500
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <hct15h$1fe$1@fred.mathworks.com>
References: <hcqnh2$2sk$1@fred.mathworks.com>
NNTP-Posting-Host: motedayenavali.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1257375729 1518 144.212.211.221 (4 Nov 2009 23:02:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 23:02:09 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
In-Reply-To: <hcqnh2$2sk$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:582554


Justin wrote:
> We are using simulink in order to play a finite file. We converted an audio file into a sample and time array and are using the from workspace simulink block in order to upload the needed data. However, before we can see the data on a scope, the signal has already passed through the system, and therefore we cannot see anything but 0. What we want to do is to essentially trigger the sending of the signal  whenever we so choose (i.e. a switch). However, whenever we use a switch the signal is sent in the background. Is there a way to permanently save the signal from workspace into the simulink model and then trigger it when we want it to send? We have already attempted to use an embedded matlab function in order to load the data from workspace but it gives an error about command duality.

Justin,
Three things come to my mind:
1. Why don't you set the "From Workspace" block to "Cyclic repetition" 
after the data runs out?
2. If cyclic repetition is not an option, you can use an enabled 
subsystem (i.e. put the source block inside an enabled subsystem, and 
enable that subsystem when you need the data to be sent).
3. If you have Signal Processing Toolbox, you can read audio files 
directly using a "From Wave file" or "From multimedia file" blocks.

btw, Embedded MATLAB is probably complaining because you're using a 
syntax like this:
load foo.mat
This is a command-line type syntax that is not allowed; you must use 
function-style syntax for everything:
load('foo.mat')
And if you use load, remember to declare the "load" function as 
eml.extrinsic since it's not supported natively in Embedded MATLAB.

HTH,
Idin

-- 
Idin Motedayen-Aval
The MathWorks, Inc.
zq=[4 2 5 -15 -1 -3 24 -57 45 -12 19 -12 15 -8 3 -7 8 -69 53 12 -2];
char(filter(1,[1,-1],[105 zq])), clear zq