Loading / importing *.lvm file in matlab

Dear all,
Thanks for a great help site. I'm trying to load a *.lvm file like this short 4KB example http://dl.dropbox.com/u/12840152/test18xy.lvm pretty standard 2011 *.lvm file I guess.
Tried out a couple of things myself, e.g.:
I) When I use the v1.2 lvm_import file as uploaded by "M. A. Hopcroft" as it is I get the same error as "Vepashka" as "Error in ==> lvm_import at 357 data.(fieldnm).Comment = rawdata{numdatacols+2}{1};"
II) When I comment out the "consolidate into a simple array" part starting at line 349 and just keep the line 349 "data.data=rawdata" then I am able to complete the import. The only trouble with method II) is that my data.data struct is empty!
I've loaded ascii *.txt files in matlab before so I don't know why this is causing me so much grief. Any help would be much appreciated as I'm struggling with my master thesis
Thanks, Kenneth Rasmussen

댓글 수: 4

Kenneth
Kenneth 2011년 9월 30일
As you can see from the example *.lvm file, the data should be pretty straight forward to load into matlab as it is in this case just 1 time column + 6 data columns, tab separated and comma decimal_separated. I think what is really putting me of is the header info that has another number of columns than the the data/time. Any help is much appreciated guys, sincerely Kenneth
Ashish Uthama
Ashish Uthama 2011년 9월 30일
http://www.mathworks.com/help/techdoc/ref/textscan.html with 'HeaderLines' ?
Kenneth
Kenneth 2011년 10월 1일
Dear Ashish Uthama, thanks for the swift reply, I tried this:
fid = fopen('test18xy.lvm');
C = textscan(fid, 'HeaderLines', '25');
fclose(fid);
But where I would expect my data to be, C returns an empty struct, weird
Sincerely,
Kenny
bym
bym 2011년 10월 1일
C = textscan(fid, 'HeaderLines', 25) <-- do not put the 25 in quotes

댓글을 달려면 로그인하십시오.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 9월 30일

0 개 추천

댓글 수: 3

Kenneth
Kenneth 2011년 10월 1일
Dear Fangjun Jiang, thanks for the swift reply, but I had already tried this way as evident from my post, cheers /Kenny
Fangjun Jiang
Fangjun Jiang 2011년 10월 1일
In your .lvm file, the decimal separator is ',', instead of the usual '.'. Is it possible for you to change that at the Labview end? I don't see lvm_import.m handles ',' as decimal separator.
It won't be hard to import your data file. But it's not that easy to write a utility that can inport a general .lvm file. Try to contact the author to see if the lvm_import.m can be upgraded. I think you found a valid defect of the utility.
Fangjun Jiang
Fangjun Jiang 2011년 10월 1일
Indeed, if I replace all the ',' in the 30x7 data array with '.', lvm_import worked and the data was successfully imported into a structure. Try it your self. You can use meditor to find-and-replace all the ',' in the data.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 LabVIEW에 대해 자세히 알아보기

제품

질문:

2011년 9월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by