sma-wideband/mlib_devel — pull request #1 by cs150bf (2012-12-20 17:41:35+00:00)
Title: adc5g_init.m initialization script for Matlab 2010 and above.

To fit changes in Simulink Downsample block
- Default values for Downsample block: sample based, allow multi-rate processing

(The Simulink block "Downsample" has went through multiple changes since 2009, and its default parameters have actually changed)

Default value in R2009b:
![downsample_default_r2009b](https://f.cloud.github.com/assets/673917/25076/33a20fb6-4acc-11e2-859b-e049f8040afa.png)

Default value in R2012a:
![downsample_default_r2012a](https://f.cloud.github.com/assets/673917/25083/3a72da78-4acc-11e2-86a1-376e98f29b3d.png)

Set value to:
![downsample_TOSET_r2012a](https://f.cloud.github.com/assets/673917/25087/47d857f6-4acc-11e2-8db6-0e7029dc1b74.png)

Effect:
![downsample_effect](https://f.cloud.github.com/assets/673917/25088/4fa270ca-4acc-11e2-8c06-7e15f2806566.png)

Some concerns
(1) The Downsample block is from Simulink block set and it has gone through some major changes since 2009. The block parameters, are implemented as pop up options in the Mask Dialogue and evaluated to integers, which is kind of awkward because it's hard for us to do something that's robust enough to stand up to future changes done by Simulink... (Say, now 'RateOptions' = 0 refers to 'Enforce single-rate processing', but could it be always the case?)

(2) Getting the Matlab version number is currently awkwardly implemented... I don't know if there's a dedicated function similar to get_xlVersion() for xilinx that exists somewhere in Casper Library, or is there some traditional way that we deal with blocks that has dependency on Simulink version... Don't know, but right now the implementation goes like this:
- get a string of version number using matlab function 'version'
- find 'R' in the raw string
- grab the four digits that comes after the 'R'... assuming there's only one 'R'
- these four digits should be the release year
But as you can see, this is quite awkward and vulnerable for future changes of Matlab

(3) The extra parameters for designs opened with Matlab version newer than 2009 .... they are attempting to stay consistent with pre-2009 versions, by preserving the old default values. But ... (see screenshots for the default values of this Downsample block for pre-2009 version and for 2012 version)