load physical constants into octave -


I was wondering if it is possible to create a file containing all the common constants that I use, and all of them Load at octave at once.

Basically every time I use Octave, I have to open my text file in which it has SI value for some physical constants, and then copy and paste it into my File I was wondering if there was any way I could avoid this work, and just type "load filename" as if I import the data, and then all my constants will be defined in one step?

Here's a way:

Suppose a file defines a constant That's the script called constants.m . Ex:

  avogadro = 6.02214179e23; Gravity_accel = 9.80665; Light_speed = 299792458;   

Place this file in a known directory. For example, I will put it in the subdirectory of my home directory called local_octave .

Edit the file (or create, if it does not exist). Octaverc in your home directory, and add the line addpath (& lt; path_to_known_directory & gt;) , but & lt; Path_to_known_directory & gt; With the place of , OK, what it says on my computer, I've added the addpath ("~ / local_octave") .

Now start the oksav to load definitions, and constant code> constants.m . E.g.

  Access: 1> Avogadro error: 1 column 1 oxide near undefined line 'avogadro': 1> Constant Octagon: 2 & gt; Avogadro avogadro = 6.0221e + 23    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -