CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Matlab problem

  1. #1
    Join Date
    Jul 2017
    Posts
    1

    Matlab problem

    I'll ask my question any, maybe the moderator will put it in the correct place, please.

    Hello

    I have a question, well many of them.

    I am currently running MatLab on 2 Windows systems and 3 Linux systems.

    The following line of code works fine in Windows but hangs in Linux....
    Code:
    	writetable(t,'P1BHE.csv','Delimiter',',')
    The routine in it's entirety follows, it reads earthquake .SAC file, creates seismographic waveform images, strips out the metadata(ascii) data and writes it to a .csv file
    -----------------------------------------------------------------------------------------------------------------------------
    CODE
    Code:
    % CURRENT WORKING CODE
    
    ds=datasource('SAC', 'P1.00.BHE.SAC');
    starttime = '2017/05/08 00:00:00';
    endtime = '2017/05/08 23:59:59';
    
    www = waveform(ds,'P1.00.BHE.SAC',starttime,endtime);
    plot(www);
    print('-f1','w00BHE plot1','-djpeg')% Save the waveform to a .jpg file
    
    T = struct2cell(www)% IS CONVERTED TO CELLARRAY
    t = cell2table(T)% this works, BUT WHAT IS IT CONVERT TO AND SAVED AS
    
    %writetable(t,'P1BHE.csv','Delimiter',',')
    %writetable(t,'P1BHE.txt')
    
    ds=datasource('SAC', 'P1.00.BHZ.SAC');
    starttime = '2017/05/08 00:00:00';
    endtime = '2017/05/08 23:59:59';
    
    ww = waveform(ds,'P1.00.BHZ.SAC',starttime,endtime);
    plot(ww);
    print('-f1','w00BHZ plot2','-djpeg')% Save the waveform to a .jpg file
    
    T = struct2cell(ww)% IS CONVERTED TO CELLARRAY
    t = cell2table(T)% this works, BUT WHAT IS IT CONVERT TO AND SAVED AS
    
    %writetable(t,'P2BHZ.csv','Delimiter',',')
    
    
    
    ds=datasource('SAC', 'P1.00.BHN.SAC');
    starttime = '2017/05/08 00:00:00';
    endtime = '2017/05/08 23:59:59';
    
    w = waveform(ds,'P1.00.BHN.SAC',starttime,endtime);
    plot(w);
    print('-f1','w00BHN plot3','-djpeg')% Save the waveform to a .jpg file
    
    T = struct2cell(w)% IS CONVERTED TO CELLARRAY
    t = cell2table(T)% this works, BUT WHAT IS IT CONVERT TO AND SAVED AS
    
    %writetable(t,'P3BHN.csv','Delimiter',',')
    %--------------------------------------------------------------
    
    ds=datasource('SAC', 'P1.10.BHE.SAC');
    starttime = '2017/05/08 00:00:00';
    endtime = '2017/05/08 23:59:59';
    
    xxx = waveform(ds,'P1.10.BHE.SAC',starttime,endtime);
    plot(xxx);
    print('-f1','x10BHE plot1','-djpeg')% Save the waveform to a .jpg file
    
    T = struct2cell(xxx)% IS CONVERTED TO CELLARRAY
    t = cell2table(T)% this works, BUT WHAT IS IT CONVERT TO AND SAVED AS
    
    %writetable(t,'P1_10BHE.csv','Delimiter',',')
    
    
    ds=datasource('SAC', 'P1.10.BHZ.SAC');
    starttime = '2017/05/08 00:00:00';
    endtime = '2017/05/08 23:59:59';
    
    xx = waveform(ds,'P1.10.BHZ.SAC',starttime,endtime);
    plot(xx);
    print('-f1','x10BHZ plot2','-djpeg')% Save the waveform to a .jpg file
    
    T = struct2cell(xx)% IS CONVERTED TO CELLARRAY
    t = cell2table(T)% this works, BUT WHAT IS IT CONVERT TO AND SAVED AS
    
    %writetable(t,'P2_10BHZ.csv','Delimiter',',')
    
    ds=datasource('SAC', 'P1.10.BHN.SAC');
    starttime = '2017/05/08 00:00:00';
    endtime = '2017/05/08 23:59:59';
    
    x = waveform(ds,'P1.10.BHN.SAC',starttime,endtime);
    plot(x);
    print('-f1','x10BHN plot3','-djpeg')% Save the waveform to a .jpg file
    
    T = struct2cell(x)% IS CONVERTED TO CELLARRAY
    t = cell2table(T)% this works, BUT WHAT IS IT CONVERT TO AND SAVED AS
    
    %writetable(t,'P3_10BHN.csv','Delimiter',',')
    %------------------------------------------------
    Any help is appreciated

    cplmckenzie
    Last edited by 2kaud; July 16th, 2017 at 03:47 AM. Reason: Added code tags

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Matlab problem

    Why this site came up an Google Search for Matlab I'll never know but.....
    Because several people have previously asked for Matlab help here. Don't know about the usefulness of the replies though.......
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured