<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#330000">
<div class="moz-cite-prefix">On 31/07/2012 11:36, Maillard,
Guillaume wrote:<br>
</div>
<blockquote
cite="mid:55A12CBC06A8C9459DCE0BBEF8122FDC0A112D68@exchsrv.AUXITROL1"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<meta name="GENERATOR" content="MSHTML 8.00.6001.19258">
<div><font face="Arial" size="2"><span class="419532309-31072012">Bonjour,</span></font></div>
<div><font face="Arial" size="2"><span class="419532309-31072012"></span></font> </div>
<div><font face="Arial" size="2"><span class="419532309-31072012">Je
cherche à faire ceci:</span></font></div>
<div><font face="Arial" size="2"><span class="419532309-31072012"></span></font> </div>
<div><font face="Arial" size="2"><span class="419532309-31072012">
- importer des données d'une feuille Excel dans Scilab</span></font></div>
<div><font face="Arial" size="2"><span class="419532309-31072012">
- puis renvoyer les données modifiées sur la même feuille
Excel.</span></font></div>
<div><font face="Arial" size="2"><span class="419532309-31072012"></span></font> </div>
<div><font face="Arial" size="2"><span class="419532309-31072012"></span></font> </div>
<div><font face="Arial" size="2"><span class="419532309-31072012"></span></font> </div>
<div><font face="Arial" size="2"><span class="419532309-31072012">J'ai
essayé avec ceci:</span></font></div>
<div><font face="Arial" size="2"><span class="419532309-31072012"> </span></font></div>
<font face="Arial" size="2">
<div class="programlisting">
<table border="0" width="100%">
<tbody>
<tr>
<td width="98%">
<div align="left">
<pre class="scilabcode"><span class="scilabid">Sheets</span> <span class="scilaboperator">=</span> <span class="scilabmacro">readxls</span><span class="scilabopenclose">(</span><span class="scilabstring">'SCI/modules/spreadsheet/demos/xls/t1.xls'</span><span class="scilabopenclose">)</span>
<span class="scilabcomment">// some basic operations on Sheets</span>
<a moz-do-not-send="true" class="scilabmacro" href="outbind://3/typeof.html">typeof</a><span class="scilabopenclose">(</span><span class="scilabid">Sheets</span><span class="scilabopenclose">)</span>
<span class="scilabid">s1</span><span class="scilaboperator">=</span><span class="scilabid">Sheets</span><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span> <span class="scilabcomment">//get the first sheet</span>
<a moz-do-not-send="true" class="scilabmacro" href="outbind://3/typeof.html">typeof</a><span class="scilabopenclose">(</span><span class="scilabid">s1</span><span class="scilabopenclose">)</span>
<span class="scilabid">s1</span><span class="scilaboperator">.</span><span class="scilabfield">value</span> <span class="scilabcomment">//get the first sheet value field</span>
<span class="scilabid">s1</span><span class="scilaboperator">.</span><span class="scilabfield">text</span> <span class="scilabcomment">//get the first sheet text field</span>
<span class="scilabid">s1</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabdefault">,</span><span class="scilabspecial">:</span><span class="scilabopenclose">)</span> <span class="scilabcomment">//get the 2 row of the sheet</span>
<a moz-do-not-send="true" class="scilabmacro" href="outbind://3/typeof.html">typeof</a><span class="scilabopenclose">(</span><span class="scilabid">s1</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabdefault">,</span><span class="scilabspecial">:</span><span class="scilabopenclose">))</span></pre>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</font><span style="COLOR: rgb(74,85,219)"></span>
<pre style="FONT-STYLE: normal; FONT-FAMILY: Monospaced; FONT-SIZE: 14px"><span style="COLOR: rgb(74,85,219)"><span class="419532309-31072012"><font color="#000000">Mais quand je veux envoyer les nouvelles données vers la page Excel, il me dit que le fichier est en lecture seul.</font></span></span></pre>
<pre style="FONT-STYLE: normal; FONT-FAMILY: Monospaced; FONT-SIZE: 14px"><span style="COLOR: rgb(74,85,219)"><span class="419532309-31072012"><font color="#000000">J'ai aussi essayé avec:</font></span></span></pre>
<pre style="FONT-STYLE: normal; FONT-FAMILY: Monospaced; FONT-SIZE: 14px"><span style="COLOR: rgb(74,85,219)"><span class="419532309-31072012"><font color="#000000"><pre style="FONT-STYLE: normal; FONT-FAMILY: Monospaced; FONT-SIZE: 14px"><span style="FONT-STYLE: italic; COLOR: rgb(1,168,1)">//Decode ole file, extract and open Excel stream</span>
<span style="COLOR: rgb(74,85,219)">[</span><span style="COLOR: rgb(0,0,0)">fd</span><span style="COLOR: rgb(0,0,0)">,</span><span style="COLOR: rgb(0,0,0)">SST</span><span style="COLOR: rgb(0,0,0)">,</span><span style="COLOR: rgb(0,0,0)">Sheetnames</span><span style="COLOR: rgb(0,0,0)">,</span><span style="COLOR: rgb(0,0,0)">Sheetpos</span><span style="COLOR: rgb(74,85,219)">]</span> <span style="COLOR: rgb(92,92,92)">=</span> <span style="COLOR: rgb(50,185,185)">xls_open</span><span style="COLOR: rgb(74,85,219)">(</span><span style="COLOR: rgb(0,0,0)">PATH</span> <span style="COLOR: rgb(92,92,92)">+</span> <span style="COLOR: rgb(188,143,143)">'</span><span style="COLOR: rgb(188,143,143)">/troe.xls</span><span style="COLOR: rgb(188,143,143)">'</span><span style="COLOR: rgb(74,85,219)">)</span>
<span style="FONT-STYLE: italic; COLOR: rgb(1,168,1)">//Read first data sheet</span>
<span style="COLOR: rgb(74,85,219)">[</span><span style="COLOR: rgb(0,0,0)">Value</span><span style="COLOR: rgb(0,0,0)">,</span><span style="COLOR: rgb(0,0,0)">INPUT</span><span style="COLOR: rgb(74,85,219)">]</span> <span style="COLOR: rgb(92,92,92)">=</span> <span style="COLOR: rgb(50,185,185)">xls_read</span><span style="COLOR: rgb(74,85,219)">(</span><span style="COLOR: rgb(0,0,0)">fd</span><span style="COLOR: rgb(0,0,0)">,</span><span style="COLOR: rgb(0,0,0)">Sheetpos</span><span style="COLOR: rgb(74,85,219)">(</span><span style="COLOR: rgb(188,143,143)">1</span><span style="COLOR: rgb(74,85,219)">)</span><span style="COLOR: rgb(0,0,0)">,</span><span style="COLOR: rgb(188,143,143)">'</span><span style="COLOR: rgb(188,143,143)">.</span><span style="COLOR: rgb(188,143,143)">'</span><span style="COLOR: rgb(74,85,219)">)</span></pre><pre style="FONT-STYLE: normal; FONT-FAMILY: Monospaced; FONT-SIZE: 14px"><span style="COLOR: rgb(74,85,219)"></span> </pre></font></span!
></span>
</pre>
<pre style="FONT-STYLE: normal; FONT-FAMILY: Monospaced; FONT-SIZE: 14px"><span style="COLOR: rgb(74,85,219)"><span class="419532309-31072012"><font color="#000000">Mais les nombres décimaux après la virgule ne sont pas lus. </font></span></span></pre>
<pre style="FONT-STYLE: normal; FONT-FAMILY: Monospaced; FONT-SIZE: 14px"><span style="COLOR: rgb(74,85,219)"><span class="419532309-31072012"><font color="#000000">Comment puis je résoudre mon problème ?</font></span></span></pre>
<pre style="FONT-STYLE: normal; FONT-FAMILY: Monospaced; FONT-SIZE: 14px"><span style="COLOR: rgb(74,85,219)"><span class="419532309-31072012"><font color="#000000">Je vous remercie pour votre temps et votre considération,</font></span></span></pre>
<pre style="FONT-STYLE: normal; FONT-FAMILY: Monospaced; FONT-SIZE: 14px"><span style="COLOR: rgb(74,85,219)"><span class="419532309-31072012"><font color="#000000" face="Arial" size="2">Cordialement,</font></span></span></pre>
<pre>--------
</pre>
</blockquote>
Bonjour<br>
<br>
Dans ma propre expérience, utiliser les fonctions xlsread et/ou xls
open esst pénible.<br>
<br>
A la place, je sauvegarde chacun des onglets (souvent il n'y en à
qu'un) du fichier excel en csv, puis j'utilise csv_readwrite :
<a class="moz-txt-link-freetext" href="http://atoms.scilab.org/toolboxes/csv_readwrite/">http://atoms.scilab.org/toolboxes/csv_readwrite/</a><br>
Ca ne marche que s'il n'y a pas de formules dans le fichier excel
(juste des chiffres et des lettres) mais il parait que la plupart
des fichiers excel n'en contiennent pas...<br>
<br>
J'espère que ça vous aidera<br>
AVS<br>
<br>
<br>
<br>
<br>
</body>
</html>