필터 지우기
필터 지우기

How to Import compex numbers from excel to matlab?

조회 수: 3 (최근 30일)
Le Dung
Le Dung 2018년 12월 21일
Hi everyone!
My problem is: I have vecto x contains double numbers, x = (1 2 3 4) and a vecto y contains complex numbers, y = (1+2i 2+3i 4+5i 5+6i)
I create a matrix z = [x;y],
And, then, i want to create a excel file (see code below)
I have a file excel that has two rows:
1 2 3 4
1+2i 2+3i 4+5i 5+6i
And, now, i want to get again data from excel file, but i can't.
i only get first row of the excel file in aaaa variable.
Of course, i can use:
[aaaa,text] = xlsread(aaa), and, then convert strings in text to numbers. But, it is not general.
Do you have any best the way that is more general, i mean use directly "aaaa"
My code:
x = [1 2 3 4]
y = [1+2i 2+3i 4+5i 5+6i]
z = [x;y]
% Create a excel file
zz = num2cell(z)
zzz = cellfun(@num2str,zz,'UniformOutput',false)
xlswrite('zzz.xlsx',zzz)
% Load data from file excel to matlab
aaa = uigetfile('*.xlsx')
aaaa = xlsread(aaa)
Thank you so much!

답변 (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