How to Import compex numbers from excel to matlab?

3 vues (au cours des 30 derniers jours)
Le Dung
Le Dung le 21 Déc 2018
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!

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by