+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Member level 3
    Points: 1,038, Level: 7

    Join Date
    Mar 2015
    Posts
    55
    Helped
    1 / 1
    Points
    1,038
    Level
    7

    Import chipscopes data to matlab

    hi every one. i want to log some data bus in chip_scope and import this data to matlab.
    with ascii exporting data bus, chip_scope gives txt file like this
    Click image for larger version. 

Name:	Capturesdfsd.PNG 
Views:	9 
Size:	13.4 KB 
ID:	153775
    how can i take this hex datas from txt file with matlab and convert it to integer?
    thanks

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 5
    Points: 23,780, Level: 37
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,564
    Helped
    1004 / 1004
    Points
    23,780
    Level
    37

    Re: Import chipscopes data to matlab

    You could have just looked this up yourself, but use hex2dec


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  3. #3
    Member level 3
    Points: 1,038, Level: 7

    Join Date
    Mar 2015
    Posts
    55
    Helped
    1 / 1
    Points
    1,038
    Level
    7

    Re: Import chipscopes data to matlab

    thanks. how can i just import this hex data to MATLAB.? as you see there is sample window and sample buffer which i have to ignore. i dont know how...



    •   AltAdvertisement

        
       

  4. #4
    Advanced Member level 4
    Points: 8,390, Level: 21
    Achievements:
    7 years registered Created Blog entry
    dpaul's Avatar
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    1,252
    Helped
    272 / 272
    Points
    8,390
    Level
    21
    Blog Entries
    1

    Re: Import chipscopes data to matlab

    how can i just import this hex data to MATLAB.? as you see there is sample window and sample buffer which i have to ignore.
    Just write a script in your fav scripting language (Bash, Perl, Python) which will read the txt file you have posted and write out the desired file to be read by MAtlab.
    FPGA enthusiast!



  5. #5
    Advanced Member level 5
    Points: 23,780, Level: 37
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,564
    Helped
    1004 / 1004
    Points
    23,780
    Level
    37

    Re: Import chipscopes data to matlab

    Quote Originally Posted by dpaul View Post
    Just write a script in your fav scripting language (Bash, Perl, Python) which will read the txt file you have posted and write out the desired file to be read by MAtlab.
    You could just write the script in MATLAB; why bother bringing another tool into the mess? Just use fopen and fgetl to read each line. You'll have to parse the line depending on your data. For your case it looks like you just need to extract the third element and stick it into an array which you play with after all the lines have been read in. Something like:


    Code:
    while 1
    line=fgetl(fileid);
    if ~ischar(line),break,end;
    c=strsplit(line);
    data=eval(char(c(3)));
    d_array(index)=data;
    index+1;
    end



    •   AltAdvertisement

        
       

  6. #6
    Advanced Member level 4
    Points: 8,390, Level: 21
    Achievements:
    7 years registered Created Blog entry
    dpaul's Avatar
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    1,252
    Helped
    272 / 272
    Points
    8,390
    Level
    21
    Blog Entries
    1

    Re: Import chipscopes data to matlab

    You could just write the script in MATLAB; why bother bringing another tool into the mess?
    I don't use Matlab!
    So I jst gave the basic idea of using scripts. Now if it can be done in Matlab, good for the OP.
    FPGA enthusiast!



  7. #7
    Advanced Member level 5
    Points: 23,780, Level: 37
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,564
    Helped
    1004 / 1004
    Points
    23,780
    Level
    37

    Re: Import chipscopes data to matlab

    Quote Originally Posted by dpaul View Post
    I don't use Matlab!
    So I jst gave the basic idea of using scripts. Now if it can be done in Matlab, good for the OP.
    The question was “how to import into matlab”. You answered a totally different question.



  8. #8
    Advanced Member level 4
    Points: 8,390, Level: 21
    Achievements:
    7 years registered Created Blog entry
    dpaul's Avatar
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    1,252
    Helped
    272 / 272
    Points
    8,390
    Level
    21
    Blog Entries
    1

    Re: Import chipscopes data to matlab

    Sorry, my bad......didn't read #1 thoroughly.
    FPGA enthusiast!



--[[ ]]--