I have yet to successfully execute an Octave script

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

I have yet to successfully execute an Octave script

Daniel Collins

Folks,

 

                I am a new user using Octave 4.2.0 in Windows 7.  I have yet to successfully execute even 1 script.  What is wrong with the following code?

 

filename = "first1.txt";

fid = fopen(filename, "w");

m = [1 2 3;4 5 6;7 8 9];

v = [1;2;3];

x = m*v;

fprintf(fid,'x = %.1f\n%.1f\n%.1f\n',x);

 

Thanks for any advice that may be offered.

-Daniel J. Collins

571-406-9708

 


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: I have yet to successfully execute an Octave script

marco atzeri-2
On 16/07/2017 10:04, Daniel Collins wrote:

> Folks,
>
>
>
>                 I am a new user using Octave 4.2.0 in Windows 7.  I have
> yet to successfully execute even 1 script.  What is wrong with the
> following code?
>
>
>
> filename = "first1.txt";
>
> fid = fopen(filename, "w");
>
> m = [1 2 3;4 5 6;7 8 9];
>
> v = [1;2;3];
>
> x = m*v;
>
> fprintf(fid,'x = %.1f\n%.1f\n%.1f\n',x);
>
>
>
> Thanks for any advice that may be offered.
>
> -Daniel J. Collins
>

the code works for me. So how are you trying to run the script and what
are the error messages ?

Marco

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: I have yet to successfully execute an Octave script

Dmitri A. Sergatskov
In reply to this post by Daniel Collins


On Sun, Jul 16, 2017 at 3:04 AM, Daniel Collins <[hidden email]> wrote:

Folks,

 

                I am a new user using Octave 4.2.0 in Windows 7.  I have yet to successfully execute even 1 script.  What is wrong with the following code?

 

filename = "first1.txt";

fid = fopen(filename, "w");

m = [1 2 3;4 5 6;7 8 9];

v = [1;2;3];

x = m*v;

fprintf(fid,'x = %.1f\n%.1f\n%.1f\n',x);


​Technically, you may want to either fclose(fid) or fflash(fid)
to make  sure the data are written to the file.​


 

 

Thanks for any advice that may be offered.

-Daniel J. Collins

<a href="tel:(571)%20406-9708" value="+15714069708" target="_blank">571-406-9708

 



​Dmitri.
​--




_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Loading...