annotate aim-mat/tools/@signal/generatefromsimulinkstructure.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % method of class @signal
tomwalters@0 2 % function sig=generatefromsimulinkstructure(sig,struct)
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 % sig: original @signal with length and samplerate
tomwalters@0 5 % struct: struct, that is exported from simulink
tomwalters@0 6 %
tomwalters@0 7 % RETURN VALUE:
tomwalters@0 8 % sig: @signal
tomwalters@0 9 %
bleeck@3 10 % This external file is included as part of the 'aim-mat' distribution package
bleeck@3 11 % (c) 2011, University of Southampton
bleeck@3 12 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 13 % download of current version is on the soundsoftware site:
bleeck@3 14 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 15 % documentation and everything is on http://www.acousticscale.org
tomwalters@0 16
tomwalters@0 17 function sig=generatefromsimulinkstructure(sig,struct)
tomwalters@0 18
tomwalters@0 19 %sr=struct.time(2)-struct.time(1);
tomwalters@0 20 sr=1;
tomwalters@0 21 len=length(struct.signals(1).values)*sr;
tomwalters@0 22 vals=struct.signals(1).values;
tomwalters@0 23
tomwalters@0 24 if size(vals,1)>1 & size(vals,2) > 1
tomwalters@0 25 vals=vals(end,:);
tomwalters@0 26 end
tomwalters@0 27
tomwalters@0 28 sig=signal(size(vals,2),1/sr);
tomwalters@0 29 sig=setvalues(sig,vals);
tomwalters@0 30
tomwalters@0 31 %sig=signal(vals);
tomwalters@0 32 %sig=setsr(sig,1/sr);
tomwalters@0 33 sig=setname(sig,struct.blockName);
tomwalters@0 34