How to Import compex numbers from excel to matlab?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!