edit cells

Hi all, just a very quick question, is it possible to handle cells in Igor in a similar way of Excel? that is - the most simple example - I set the values for 2 cells, and in another third we set the sum, that changes at the changing of one of the first 2 cells ? Thanks. G 

Yes, that is possible. However not 'as' convenient as in Excel. For this you need dependencies. Execute the following command to read more:

DisplayHelpTopic "Dependencies"

One way to create a dependency is via the ':=' assignment. Suppose you have three waves: wave1, wave2 and wavesum. To link wavesum in a way that this wave will always be updated with the sum of wave1 and wave2 you need to do this:

wavesum := wave1+wave2

Here is some code for you to test this:

Make/O/D/N=10 wave1 = p, wave2 = 2*p, wavesum
wavesum := wave1+wave2
Edit wave1, wave2, wavesum

Change any value in wave1 or wave2 and see the sum update.

I have to say that this is a nice summary explanation and example for what can be a complex topic!

Thanks a lot! Hope this will shed a bit more light on the feature. Something to add:

It is not possible to delete objects, like waves etc., which are input to a dependency (wave1 and wave2 in this example). The dependent object (wavesum) has to be deleted first or the dependency needs to be released via a 'normal' assignment without the colon (e.g., wavesum = wavesum) to make this possible. Also, unlike Excel, the whole wave gets the same formula applied, and one cannot assign Formulas freely to individual row elements. 

To expand on the explanations, I would add that, under most circumstances, when you view a table in Igor Pro

* columns are within a wave (array), and you cannot use dependencies to do the math

* rows are different waves, and this is where you can use dependencies to do your math

The extent that you might believe it is a misfortunate that Igor Pro tables do not support spreadsheet actions depends on how adamant you are about doing spreadsheet math in Igor Pro. I've also found the easier path is to do the spreadsheet math in a spreadsheet and pull the data into Igor Pro.

Finally, rather than using a dependency equation, a more robust approach for cases that must be dynamic is to create a function that does the math for you and then run that function as needed. For one-off cases, you'd not want a dependency equation anyway ... you'd want just to do this in a calculator. So do this at the command line

> print (value in cell 1 + value in cell 2)

Indeed, you can always run a function or equation on any cells you like from the command line, and that's what I often do when working with 'tables' within Igor. In this sense, the equations you would enter into an Excel cell are offloaded into a small function. It is good that one can choose when to update the values, but it is also difficult to keep things updated. I still often resort to Excel for more involved computations since it is a bit easier to have various results and values floating around, and also easily introduce visual aids like borders. But then, copy-pasting huge chunks of data from Igor is also time consuming. It really depends on the task.

Great !

Thank  you very much to you all for your help and support !!!

G