How to copy a complex matrix in the workspace to an m-file?

조회 수: 1 (최근 30일)
Ismaeel
Ismaeel 2017년 6월 13일
댓글: Ismaeel 2017년 6월 14일
I need to copy a large complex matrix from the workspace to be saved in m-file as a matrix (notice the complex sign (i or j or 1i) is not multiplied by (*). Part of the matrix is shown in the picture below.
Notice that I cannot use the code used for generating the matrix in the place (m-file) I work on for some complexity reason. Thanks in advance for your help
  댓글 수: 7
Ismaeel
Ismaeel 2017년 6월 14일
Thanks Adam, unfortunately, it only saves the real part of the complex matrix. I just tried it.
Adam
Adam 2017년 6월 14일
Does Excel itself even support complex data? You can separate it into real and imaginary parts and save those to their own columns.

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

채택된 답변

KSSV
KSSV 2017년 6월 14일
A = rand(5) ;
B = rand(5) ;
C = A+1i*B ;
C_str = num2str(C);
C_cell = cellstr(C_str);
xlswrite('test.xlsx',C_cell)
  댓글 수: 1
Ismaeel
Ismaeel 2017년 6월 14일
Thank you so much KSSV, it works with some changes in the excel file after being saved. Appreciate it. Thanks also go to Adam and Stephen.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by