Code Directory
 Visual Basic & VB.NET
New Code
The C# OCR Library 2020.11
SentiVeillance SDK Trial 7.3.2020.11.30
VaxVoIP WebPhone SDK
SentiMask SDK Trial 2.0_193121
C# QR Code Generator 2020.12
How to Read Text from an Image in C# 2020.12
The .Net PDF Library 2020.12.3
fsMediaLibrary.NET 2019.11.0
Entity Developer 6.9.1112
OrgChart JS 7.5.40
LinqConnect 4.9.2096
SSIS Data Flow Components 1.15
IP2Location Geolocation Database Oct.2020
Luxand FaceSDK 7.2
dbForge Data Compare for PostgreSQL 3.3.6
Top Code
IcrediBB Bulletin Board System 1.0
phpXplorer 0.9.12
PL-SQL code to convert number to words 1.0
NES Rom Maker 1.0
Ready Made MLM Script 1.0.4
Azizi search engine script PHP 4.1.10
jCoder - Portable Java Coding 1.0
Mojo Clicks (Sripts) 1.1
Circle Fit (Taubin method) 1.0
viPanel Package 1.1
DBISAM ADO.Net Provider 2.0.0
MMS - Museum Management System 1.0.0
Simple Web Content Management System for Scripts 1.1
SentiMask SDK Trial 2.0_193121
Scientific and Currency calculator 2.2.9
Top Rated
Uber Clone with Safety Measure Addons 2.0
Answers phpSoftPro 3.12
phpEnter 5.1.
Quick Maps For Dynamics CRM 3.1
Single Leg MLM 1.2.1
Azizi search engine script PHP 4.1.10
Paste phpSoftPro 1.4.1
Extreme Injector 3.7
Apphitect Airbnb Clone Script 1.0
Deals and Discounts Website Script 1.0.2
Pro MLM 1
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
ICPennyBid Penny Auction Script 4.0
User Defined Constants 1.0
File ID: 85238

User Defined Constants 1.0
Download User Defined Constants 1.0http://www.mathworks.comReport Error Link
License: Shareware
File Size: 10.0 KB
Downloads: 1
Submit Rating:
User Defined Constants 1.0 Description
Description: Did you ever want the ability to define a special constant that is seen by and used in all of your functions, without needing to create global variables?

For example, suppose you used the golden ratio often in your work. Rather than creating a global variable named phi, or being forced to pass a variable around as an argument to your functions, I'll just use defcon to do the work for me.

>> defcon('phi',(1+sqrt(5))/2)

Here, I used defcon to create a new function called phi on my search path, that acts like the ones and zeros functions.

>> format long g
>> phi
ans =
>> phi(1,2)
ans =
1.61803398874989 1.61803398874989

phi is now a matlab function, that can be used inside other functions without any further effort. In fact, phi even has help defined, done automatically by defcon.

>> help phi
phi - User Defined Constant:

phi(N) is an N-by-N matrix filled with 1.6180339887498949.

phi(M,N) or phi([M,N]) is an M-by-N matrix of 1.6180339887498949.

phi(M,N,P,...) or phi([M N P ...]) is an M-by-N-by-P-by-...
array of 1.6180339887498949.

phi(SIZE(A)) is the same size as A and all 1.6180339887498949.

phi with no arguments is the scalar 1.6180339887498949.

see also: ones, zeros, nan

This means that from now on, the value of phi is defined to any function or script you will use. Because phi is now a function on your search path, it will also be available to you the next time you start MATLAB too. Of course, you must still be careful, as if you name a variable phi, matlab will find the variable first.

Deletion of a defined constant is easy enough too. The new function will be stored in the same directory that defcon resides in.

>> delete(which('phi'))

See that now phi is gone from my system.

>> phi
Undefined function or variable 'phi'.

The usual caveats apply here. Be careful in creating the name of a constant that is also the name of an existing matlab function or command. And if you already have a variable with that name, again there will be a problem.

License: Shareware

Related: Script, means, matlab, Start, scalar, arguments

O/S:BSD, Linux, Solaris, Mac OS X

File Size: 10.0 KB

Downloads: 1

More Similar Code

User defined print button script creates an image that acts as a print button. The button appearance can be customized by modifying the appropriate code.

The script is cross browser compatible.

T-SQL user defined functions are explained in the weekly newsletter clearly. These user defined funtions are added to the SQL Server database which is very useful for the database administrators and programmers. UDF helps us to reuse the code any...

parseSize - a function to aid OOP overloading of the size() method in user-defined classes. If the user provides the vector of dimensions of a hypothetical array object, parseSize will take care of the main input/output argument processing in a...

A cross-platform C++ library written in platform-independent C++ which purpose is to provide the user with overrides and/or replacements for standard and/or custom I/O functions in order to support user-defined character sets.

This article obviously discusses about user defined data types and helps the users to create data types on .NET framework by using Yukon and whidbey of Visual Studio.NET. This article has provided different procedures which is used for creating...

User Defined Table has a new name! Form and List

Core Module "User Defined Table" allows the creation of a list of records with fields, that can be specified by the page admin interactively. Each field gets a dedicated type...

nother method of PWM generation using user defined block

Function nor2d.m helps to rescale original 2D data (images) to a user defined new MIN and MAX values. It can be very easily extended to 3D.

For any MATLAB version.

Creates relationships between Wordpress MU blog posts based on user defined tags, relevant Open Calais tags and extracted terms.

The Format Number API module provides a method to configure number formats (site default and user defined) with configurable decimal point and thousand separators.

Since 6.x-1.6: This module also provides the 'numericfield' Forms API...

User Review for User Defined Constants
- required fields

Please enter text on the image