Move data from a MATLAB program to python -
i new programming, , started programming in python 3. data want analyze have been processed in matlab program, , need export them. don't know matlab, , after searching web came this:
fileid = fopen('vara.txt','w'); fprintf(fileid,'%.10f \n',data_1(:,1)); fclose(fileid); fileid = fopen('varb.txt','w'); fprintf(fileid,'%.10f \n',data_1(:,2)); fclose(fileid);
this gives me 2 .txt files x , y coordinates respectively. have 1000 strings (which each contains 10k datapoints), seems awful way this.
my question then; how can export these datasets efficient code? instance: writing dataset 2 different .txt files separates 2 variables, instead of hash saved in 1 file.
if interested in exporting lot of structured numerical data, recommend use hdf5 functions in matlab write these, , corresponding python library read these.
to simplify code showed there, read dlmwrite in matlab help.
the way choose (or via dlmwrite) may sound awful in beginning, not have impact on performance.
Comments
Post a Comment