Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Copy with Matlab

DindogDindog Posts: 2Member
Hi!
I have this problem: I have a big data list in .txt file, with three columns and various lines; a variable number of lines constitutes a series.
At the end of each series, there is a blank line. Then another series starts.

i.e.
20 23 103
98 23 92
22 11 118

15 15 22
11 33 33
55 55 55
98 22 22

43 44 23
33 33 44

...and so on.
I would like to copy each series near the previous series.
The copy of each series should end when it reaches the blank line.

i.e.
20 23 103 15 15 22 43 44 23
98 23 92 11 33 33 33 33 44
22 11 118 55 55 55
98 22 22

I have a Macro doing this in Excel...

Sub mergeline()
Dim OutSh As Worksheet, DataSh As Worksheet
Dim I As Long, IBlkC As Long, BlkLen As Long
'
Set OutSh = ThisWorkbook.Sheets("Merge") '<< Il foglio dove si costruisce l' output
Set DataSh = ThisWorkbook.Sheets("Foglio1") '<< Il foglio con i dati di partenza
datacell = "A2" '<< La cella da cui partono i dati
'
OutSh.Cells.ClearContents
For I = 1 To DataSh.Cells(Rows.Count, Range(datacell).Column).End(xlUp).Row
If DataSh.Range(datacell).Offset(I - 1, 0) = "" Then
IBlkC = 0
Else
DataSh.Range(datacell).Offset(I - 1, 0).Resize(1, Application. _
WorksheetFunction.CountA(DataSh.Range(datacell).Offset(I - 1, 0).EntireRow)).Copy _
Destination:=OutSh.Range(datacell).Offset(IBlkC, Application.WorksheetFunction. _
CountA(OutSh.Range(datacell).Offset(IBlkC, 0).Resize(1, Columns.Count - 5)))
IBlkC = IBlkC + 1
End If
Next I
End Sub

...but I would like to do it in Matlab.
Any idea?
Thank you,

Ale

Comments

  • YashabYashab Posts: 13Member
    MATLAB a numerical computing programming language being heavily used nowadays. If you are worried about your MATLAB assignments and final year projects? We have been providing MATLAB based assistance to students from various universities in graduate and undergraduate level. We provide high quality MATLAB projects & assignment help for students in universities of UK, USA, Australia, India, Dubai, KSA , Canada and several European countries at reasonable rates. Our assignments guarantee maximum grades, we not only make assignments, and we tutor the students as well so that next time they try themselves. We believe in sharing knowledge and enabling students to facilitate with maximum knowledge and quality work. Visit our website at
    www.makeyourassignment.com
    makeyourassignment@gmail.com
  • YashabYashab Posts: 13Member
    MATLAB a numerical computing programming language being heavily used nowadays. If you are worried about your MATLAB assignments and final year projects? We have been providing MATLAB based assistance to students from various universities in graduate and undergraduate level. We provide high quality MATLAB projects & assignment help for students in universities of UK, USA, Australia, India, Dubai, KSA , Canada and several European countries at reasonable rates. Our assignments guarantee maximum grades, we not only make assignments, and we tutor the students as well so that next time they try themselves. We believe in sharing knowledge and enabling students to facilitate with maximum knowledge and quality work. Visit our website at
    www.makeyourassignment.com
    makeyourassignment@gmail.com
Sign In or Register to comment.