0

I create a variable called delay

set delay [expr ($max-$min)];

I want to use it in a array like:

set_value/$env(sim_name)/taps  {{0,0,$delay,0,0}}; #double[5]

But brace will stop to substitution the value of delay, right?

The fault said is invalid_float or zero element array.

what could I do?

5
  • 1
    You're trying to pass more than 2 arguments to a set command? Commented Aug 5, 2013 at 9:12
  • I edited it from “set value” to “set_value”. It is just one argument. Commented Aug 5, 2013 at 10:00
  • Well, now there's no command like that built in Tcl... Could you elaborate on what you're trying to do exactly? Commented Aug 5, 2013 at 10:21
  • With the third version of your question, did you intend to have a space after set_value, or is the command really that whole word set_value/$env(sim_name)/taps? Commented Aug 5, 2013 at 10:53
  • Ask your other questions as new questions. That's how Stack Overflow works. Commented Aug 6, 2013 at 8:42

1 Answer 1

1

The outermost braces are for quoting. A good rule for quoting is to use what works. In other words, don't use curly braces if you don't want the behavior of curly braces. If you need to have variables expanded, use double quotes:

set_value/$env(sim_name)/taps "{0,0,$delay,0,0}"

There's likely another thing wrong with your example. You're calling a command named "set_value/$env(sim_name)/taps", which is a rather unusual looking command name. Are you certain that's what you want to do?

Sign up to request clarification or add additional context in comments.

3 Comments

I'm guessing that it is what he wants; I've seen stuff like that in questions before. (I'm not quite sure which tool they're using, but it seems to exist.)
It is .scf file, use to setup configures of simulation.
Thank you, it solves my problem. Another thing, if I want to run iterations, using for and incr seems does not work...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.