Merging real and imaginary data in to one variable

조회 수: 1 (최근 30일)
Harvijay Raj
Harvijay Raj 2022년 5월 3일
답변: David Hill 2022년 5월 4일
Hi,
I am trying to merge 2 csv files with frequency response in to one as "freq, real data1, imag data1, real data2, imag data2 etc..." format. One file contains "freq, real data1, real data2, real data3, etc..." and other file contains "freq, Imag data1, Imag data2, Imag data3, etc..." format.
Since this is a stastical sim, each file have about 4096 columns and doing it by hand is time consuming. I am sure there should be easy way to write script and combine it.
Please provide guidance.
Thanks.
  댓글 수: 2
KSSV
KSSV 2022년 5월 4일
Is freq samw in bot the files? Attach your data files.
Harvijay Raj
Harvijay Raj 2022년 5월 4일
Yes, Frequency is same. Both Real data and Imag data are from same Sim so they are exactly same in first column. Its just they end up in different place which I can not control. Since they are from same simulaition, several days worth of sim from huge sim, i am reluctant to re-do whole analysis. I am looking for a way to arrange them in the format like "freq, real data1, imag data1, real data2, imag data2 etc..." with relatively easy scripting., Since I am not expert in scripting.
Your help is appreciated.
Thanks.

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

채택된 답변

David Hill
David Hill 2022년 5월 4일
R=readmatrix('yourData1.csv');%assuming the sizes are the same
I=readmatrix('yourData2.csv');
newMatrix=[R(:,2:end);I(:,2:end)];
newMatrix=[R(:,1),reshape(newMatrix,size(R,1),[])];

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Design and Simulate SerDes Systems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by