Important: Please read the installation page for details about how to install the toolboxes. $\newcommand{\dotp}[2]{\langle #1, #2 \rangle}$ $\newcommand{\enscond}[2]{\lbrace #1, #2 \rbrace}$ $\newcommand{\pd}[2]{ \frac{ \partial #1}{\partial #2} }$ $\newcommand{\umin}[1]{\underset{#1}{\min}\;}$ $\newcommand{\umax}[1]{\underset{#1}{\max}\;}$ $\newcommand{\umin}[1]{\underset{#1}{\min}\;}$ $\newcommand{\uargmin}[1]{\underset{#1}{argmin}\;}$ $\newcommand{\norm}[1]{\|#1\|}$ $\newcommand{\abs}[1]{\left|#1\right|}$ $\newcommand{\choice}[1]{ \left\{ \begin{array}{l} #1 \end{array} \right. }$ $\newcommand{\pa}[1]{\left(#1\right)}$ $\newcommand{\diag}[1]{{diag}\left( #1 \right)}$ $\newcommand{\qandq}{\quad\text{and}\quad}$ $\newcommand{\qwhereq}{\quad\text{where}\quad}$ $\newcommand{\qifq}{ \quad \text{if} \quad }$ $\newcommand{\qarrq}{ \quad \Longrightarrow \quad }$ $\newcommand{\ZZ}{\mathbb{Z}}$ $\newcommand{\CC}{\mathbb{C}}$ $\newcommand{\RR}{\mathbb{R}}$ $\newcommand{\EE}{\mathbb{E}}$ $\newcommand{\Zz}{\mathcal{Z}}$ $\newcommand{\Ww}{\mathcal{W}}$ $\newcommand{\Vv}{\mathcal{V}}$ $\newcommand{\Nn}{\mathcal{N}}$ $\newcommand{\NN}{\mathcal{N}}$ $\newcommand{\Hh}{\mathcal{H}}$ $\newcommand{\Bb}{\mathcal{B}}$ $\newcommand{\Ee}{\mathcal{E}}$ $\newcommand{\Cc}{\mathcal{C}}$ $\newcommand{\Gg}{\mathcal{G}}$ $\newcommand{\Ss}{\mathcal{S}}$ $\newcommand{\Pp}{\mathcal{P}}$ $\newcommand{\Ff}{\mathcal{F}}$ $\newcommand{\Xx}{\mathcal{X}}$ $\newcommand{\Mm}{\mathcal{M}}$ $\newcommand{\Ii}{\mathcal{I}}$ $\newcommand{\Dd}{\mathcal{D}}$ $\newcommand{\Ll}{\mathcal{L}}$ $\newcommand{\Tt}{\mathcal{T}}$ $\newcommand{\si}{\sigma}$ $\newcommand{\al}{\alpha}$ $\newcommand{\la}{\lambda}$ $\newcommand{\ga}{\gamma}$ $\newcommand{\Ga}{\Gamma}$ $\newcommand{\La}{\Lambda}$ $\newcommand{\si}{\sigma}$ $\newcommand{\Si}{\Sigma}$ $\newcommand{\be}{\beta}$ $\newcommand{\de}{\delta}$ $\newcommand{\De}{\Delta}$ $\newcommand{\phi}{\varphi}$ $\newcommand{\th}{\theta}$ $\newcommand{\om}{\omega}$ $\newcommand{\Om}{\Omega}$
perform_scilab_conversion - convert a matlab file to scilab
perform_scilab_conversion(name);
If name is empty, process all the files.
Copyright (c) 2008 Gabriel Peyre
if nargin <2
outdir = '../ scilab/ '
if nargin <3
toolbox_dir = '../ matlab/ '
if nargin <1 || isempty(name)
% back processing
list_ext = {'coding_' 'introduction_' 'image_' 'audio_' 'wavelet_' 'sparsity_' 'cs_' ...
'denoising_' 'inverse_' 'graphics_' 'multidim_' 'meshproc_' 'meshdeform_' ...
'meshwav_' 'variational_' 'fastmarching_'}
a = dir('*_*.m')
for i in 1: length(a):
name = a(i).name
for k in 1: length(list_ext):
if not(isempty(findstr(name, list_ext{k})))
disp(['--- > Translating ' name ' ...'])
perform_scilab_conversion(name(1: end-2))
return
fid = fopen([name '.m'], 'rt')
fidout = fopen([outdir name '.sce'], 'wt')
if fid <0
error(['Cannot open ' name '.m.'])
str1 = {'%' '\' 'getd('''}
str2 = {'/ /' '\\' ['getd(''' toolbox_dir]}
while true
s = fgets(fid)
if s <0
break
% remove comments and stufs
for i in 1: length(str1):
s = strrep(s, str1{i}, str2{i})
makeoutput = 1
if length(s) >5 && strcmp(s(1: 6), 'getd = ')
makeoutput = 0
if length(s) >28 && strcmp(s(1: 28), 'perform_toolbox_installation')
process_header(fidout, s)
makeoutput = 0
% write output
if makeoutput
fprintf(fidout, s)
fclose(fid)
fclose(fidout)
function process_header(fidout, s)
tbx = {}
if findstr(s, 'signal')
tbx{end + 1} = 'signal'
if findstr(s, 'general')
tbx{end + 1} = 'general'
if findstr(s, 'graph')
tbx{end + 1} = 'graph'
if findstr(s, 'wavelet_meshes')
tbx{end + 1} = 'wavelet_meshes'
if findstr(s, 'additional')
tbx{end + 1} = 'additional'
for i in 1: length(tbx):
output_line(fidout, ['getd(''toolbox_' tbx{i} '/ ''); \n'])
function output_line(fid, s)
s = strrep(s, '%', '%%')
fprintf(fid, s)