From 72a0bba845469534bf80aba8911b5581639bf7c3 Mon Sep 17 00:00:00 2001 From: Sylvain GENIN Date: Wed, 15 Apr 2015 17:29:51 +0200 Subject: [PATCH] %_sodload can recover the struct and cell data Change-Id: I1203508b82fd8fb8a64693eafee6d582d692c35d --- scilab/modules/io/macros/%_sodload.sci | 35 +++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/scilab/modules/io/macros/%_sodload.sci b/scilab/modules/io/macros/%_sodload.sci index 50ca6a6c..1dfcf8a 100644 --- a/scilab/modules/io/macros/%_sodload.sci +++ b/scilab/modules/io/macros/%_sodload.sci @@ -47,7 +47,40 @@ function %_sodload(%__filename__, varargin) endfunction function varValue = parseList(varValue) - if typeof(varValue)=="list" then + + if or(typeof(varValue)==["cell","st"]) then + if typeof(varValue)=="st" then + fieldNames = fieldnames(varValue); + else + fieldNames = varValue; + end + + for kField = 1:size(fieldNames,"*") + + if typeof(varValue)=="st" then + fieldValue = varValue(fieldNames(kField)); + else + fieldValue = varValue{kField}; + end + + if typeof(fieldValue) == "ScilabMatrixHandle" then + fieldValue = createMatrixHandle(fieldValue); + elseif typeof(fieldValue) == "ScilabMacro" then + //convert tlist to macro + fieldValue = createMacro(fieldValue, "function"); + elseif isList(fieldValue) then + fieldValue = parseList(fieldValue); + end + + if typeof(varValue)=="st" then + varValue(fieldNames(kField)) = fieldValue; + else + varValue{kField} = fieldValue; + end + + end + + elseif typeof(varValue)=="list" then for i = definedfields(varValue) if typeof(varValue(i)) == "ScilabMatrixHandle" then varValue(i) = createMatrixHandle(varValue(i)); -- 1.7.9.5