Tag Info

Hot answers tagged

7

To import the first 100 rows of the file you can use Import["myfile.data", {"Data", Range[100]}] and to import the last 100 rows Import["myfile.data", {"Data", -Range[100]}] or Import["myfile.data", {"Data", Range[-100,-1]}]


7

I see there are no accepted answers for this question after more than 10 months so I thought I'd have a go at it. Although I have been using Mathematica for since V8, I am only an occasional user and hence not at all an expert like the others who have chimed in so far - but I'll give it a shot. Rather than using the Java based import to open and import the ...


5

Here is a package which I think does what you want: https://www.wolframcloud.com/objects/user-7053ce31-817f-4643-aec1-eda27051bba6/WebUnit.zip Download the file, and unzip it under "$UserBaseDirectory/Applications" To use it: Needs["WebUnit`"] InstallWebUnit[] (* launches chromedriver.exe *) StartWebSession[] (* launches Chrome web browser, assuming you ...


3

I encourage you to use the following command: Import["file_name.txt", "Table"][[All, ;;100]] It works by default with any structured data, while "Data" doesn't. And what's more important - surprisingly it works much faster than importing separated rows or columns - time difference could be the 10-100 times for huge files. And eventually it's much easier ...


3

(I cannot post this as a comment, sorry.) Your question seems to be a duplicate of this one: Downloading files without using Import. I have just checked the solution from there, it downloads fine zip-files from GitHub. For extracting downloaded package, you can use ExtractArchive function.


3

Starting with Mathematica 10, .mx files are only restricted by 'bitness', i.e. an .mx file generated on a 64 bit machine should be interchangeable between all 64 bit platforms (Windows-x86-64, OSX-x86-64, Linux-x86-64). Similarly, MX files generated on 32 bit platforms should be compatible with Windows-x86 and Linux-x86.


2

You can calculate the duration by counting the number of samples, and dividing by the sampling rate. For example, importing the stereo file="soundfile.wav" sr = Import[file, "SampleRate"]; {channels, samples} = Dimensions[Import[file, "Data"]]; duration = samples/sr // N


2

When you export a Table, then the array cannot be arbitrarily nested. What you should do is to export your data (which is not a matrix!) in a different format. Try: Export["data.dat", m1, "Package"] Import["data.dat", "Package"][[All, 2, 1]] // MatrixForm or Export["data.dat", m1, "MX"] Import["data.dat", "MX"][[All, 2, 1]] // MatrixForm and read the ...


2

Try some thing like this: SetDirectory[dir]; files = FileNames["*.txt"]; Export[newdir <> "\\" <> files[[#]], Cases[Import[files[[#]]], {1, _}][[;; , 2]]] & /@ Range[Length[files]]


1

Use the function 'take' for example list = Import["myfile.data",{"Data",{1,2,3},All}]; Take[list1, 100] you will get the first hundred values Take[list1, {100,200)] you wil gett the values hundred until twohundred


1

Found an easy solution: Use SystemOpen["https://github.com/****.zip"]. This will open the file in the system browser, and start the download! (Decided to post the solution here in case others have the same question)



Only top voted, non community-wiki answers of a minimum length are eligible