Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am new to Mathematica, but already find it a very nice tool. Right now I am trying to create an animation of numeric data, where each frame corresponds to a distinct text file with a table-like content.

With one static frame (file) I can do the following:

file = "Desktop/d1.txt"
data = Import[file, "Table"]
ArrayPlot[data]

Now, with multiple frames (files) I have to somehow animate a list of 2D lists, e.g.:

files = { "Desktop/d1.txt", "Desktop/d2.txt", "Desktop/d3.txt" }
data = Map[Import[#] &, files]

ListAnimate is said to accept a list:

ListAnimate[data]

,but it does not display the bitmap and shows a box with an advancing position bar and text representation of the data[[1]] . I would like to playback all the files' content as consecutive bitmaps. Should I somehow rearrange my 2D lists and/or may be ListAnimate is the wrong function for that task and I should use something else?

share|improve this question
2  
1) ListAnimate 2) there is no ArrayPlot in AnimateList/ListAnimate. So is ListAnimate[ArrayPlot/@data] what you need? –  Kuba Sep 14 '13 at 11:49
    
I am sorry for the typo, indeed it is ``ListAnimate''. –  Student4K Sep 14 '13 at 21:35
add comment

2 Answers 2

up vote 2 down vote accepted

Here's an example that does work, like Kuba says you have to give ListAnimate a list of exactly the elements you want to cycle through.

ListAnimate[Table[ArrayPlot[RandomReal[1, {3, 3}]], {i, 100}], 10]

arrayplot

In your case:

ListAnimate[Map[ArrayPlot[Import[#,"Table"]] &, files]]

Observe that the real name of the function is ListAnimate and not AnimateList.

share|improve this answer
add comment

Another way to approach this is with Manipulate:

Manipulate[ArrayPlot[RandomReal[i, {5, 5}]], {i, 1, 100}]

This creates a slider that allows you to move through the various images. By clicking on the small + sign in the upper right you can choose autorun, and it will animate through the various data.

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.