Simple question!
Simple question!
(OP)
This is probably a simple question.
When i define a new variable, how do I make it constant?
How do I protect it from being changed later on?
Help appreciated!
When i define a new variable, how do I make it constant?
How do I protect it from being changed later on?
Help appreciated!





RE: Simple question!
inside this file write x=2;
so now x=2
when you use x inside the m file it is autmatically has the same value
so if you write y=2x so y=4 is displayed
so i think the answer of your question is to use m file not the command window of matlab because in command window every time you enter you need to write your variable
RE: Simple question!
If x was a constant then you wouldn't be able to write x=3 without an error message.
Cheers
Greg Locock
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.