<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p>Thanks alot. It also works with file and read for me. But I still don't know how to handle a string header: read: Wrong number of output argument(s): 0 expected.<br /><br /></p>
<pre style="font-family: Monospaced; font-style: normal; font-size: 12.0;"><span style="color: #000000;">Koeffizienten_DM</span><span style="color: #5c5c5c;">=</span><span style="color: #32b9b9;">file</span><span style="color: #4a55db;">(</span><span style="color: #bc8f8f;">"</span><span style="color: #bc8f8f;">open</span><span style="color: #bc8f8f;">"</span><span style="color: #000000;">,</span> <span style="color: #bc8f8f;">"</span><span style="color: #bc8f8f;">C:\Users\f.nikolaisen\Documents\Bachelorarbeit\Simulation\Koeffizienten_DM_Matrix.txt</span><span style="color: #bc8f8f;">"</span><span style="color: #000000;">,</span> <span style="color: #bc8f8f;">"</span><span style="color: #bc8f8f;">old</span><span style="color: #bc8f8f;">"</span><span style="color: #4a55db;">)</span>
<span style="color: #000000;">E</span><span style="color: #5c5c5c;">=</span><span style="color: #32b9b9;">read</span><span style="color: #4a55db;">(</span><span style="color: #000000;">Koeffizienten_DM</span><span style="color: #000000;">,</span><span style="color: #5c5c5c;">-</span><span style="color: #bc8f8f;">1</span><span style="color: #000000;">,</span><span style="color: #bc8f8f;">4</span><span style="color: #4a55db;">)</span>
<span style="color: #32b9b9;">disp</span><span style="color: #4a55db;">(</span><span style="color: #000000;">E</span><span style="color: #4a55db;">)</span>
<span style="color: #32b9b9;">file</span><span style="color: #4a55db;">(</span><span style="color: #bc8f8f;">'</span><span style="color: #bc8f8f;">close</span><span style="color: #bc8f8f;">'</span><span style="color: #000000;">,</span><span style="color: #000000;">Koeffizienten_DM</span><span style="color: #4a55db;">)</span><span style="color: #000000;">;</span></pre>
<p><br />Could I still choose the document as a user? And having there not an abselout path, but the current directory opened.</p>
<p>Sorry for this beginners questions, its really hard to get this details with the Scilab help.</p>
<p>Greetings</p>
<p>Frieder</p>
<p> </p>
<p> </p>
<p>Am 2017-03-20 17:53, schrieb Tim Wescott:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<pre>On Mon, 2017-03-20 at 17:26 +0100, Frieder Nikolaisen wrote:</pre>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">Hello, I do try to read a matrix of floating point numbers from a text file. I want to have floating point numbers in Sciliab. (I used before mgetl which return strings). I have attached the example text file and scilab file. The error it says is: read: Wrong number of output argument(s): 0 expected. Thank you. Greetings Frieder My code: Koeffizienten_Pfad = uigetfile(["*.txt"],'',"Wählen Sie die Datei Koeffizienten"); Koeffizienten = mopen(Koeffizienten_Pfad) B = read(Koeffizienten,-1,4) disp(B) mclose('all')</blockquote>
<pre>Scilab has multiple contradictory ways of managing files. It appears
that "mopen" is not compatible with "read". To use read:
-->file("open", "bob.txt", "old");
-->read(bob, -1, 4)
ans =
1. 2. 3. 4.
5. 6. 7. - 8.
-->file("close", bob);
However, if you can trust that your file will always be in a tidy
format, you can use fscanfMat:
-->fscanfMat("bob.txt")
ans =
1. 2. 3. 4.
5. 6. 7. - 8.
(You can also use mopen and mfscanf -- the "file" stuff is "Fortran-
like", the "mopen" stuff is "C-like", and fscanfMat is just convenient.
I tend to use the C-like stuff because most of my "real" programming
work is done in C, so I'm familiar with it. Pick your poison.)
</pre>
</blockquote>
<p> </p>
<div> </div>
</body></html>