[Discuss] Bash Script WIth Octave

Andrew M. B. Boktor andrew.botros at gmail.com
Thu Aug 18 10:45:58 PDT 2016


Yes there is, lookup the manual for octave command

On Tue, Aug 16, 2016 at 6:17 PM, pw <p.willis at telus.net> wrote:

> Hello,
>
> I am using octave on Ubuntu 15~ish. I want to run a shell script that
> directly runs some octave code.
>
> Is there a way to make octave load and run code from a shell script as
> follows?
>
> Thanks
>
> P
>
>
> #/usr/bin/octave
> a=[
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
> 1,1,1,1,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,1,0,1,1,0,1,1,0,0,0,0,
> 1,1,0,1,0,0,0,0,0,0,0,1,1,1,1;
> 1,1,1,1,0,1,1,1,1,1,0,1,0,0,0,0,1,1,1,1,0,0,0,1,0,1,1,1,0,1,
> 1,0,1,1,0,1,1,1,1,1,0,1,1,1,1;
> 1,1,1,1,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,0,1,
> 1,1,1,1,0,1,0,0,0,1,0,1,1,1,1;
> 1,1,1,1,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,
> 1,0,1,1,0,1,0,0,0,1,0,1,1,1,1;
> 1,1,1,1,0,1,0,0,0,1,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0,1,1,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,0,
> 1,1,1,1,0,0,0,0,0,0,0,1,1,1,1;
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
> ]
> colormap(gray)
> img01 = imagesc(a)
>
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://vlug.org/mailman/listinfo/discuss_vlug.org
>



-- 
Andrew Boktor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vlug.org/pipermail/discuss_vlug.org/attachments/20160818/74cb0a1d/attachment.html>


More information about the Discuss mailing list