How to set the matrix of the .mat file to double or other types?

30 ビュー (過去 30 日間)
Ariel
Ariel 2020 年 6 月 19 日
コメント済み: Ariel 2020 年 6 月 19 日
I try to use fmincon with options being
M = 2;
DC = false;
pulse = load('PCB1.mat');
[pdaeye,th] = pulse2pda(pulse,100000,M,DC);
figure
t = th*SymbolTime*1e12;
plot(t,pdaeye)
legend('Upper PDA eye','Lower PDA eye')
xlabel('ps')
ylabel('V')
title('Peak Distortion Analysis Eye')
grid on
and this is the error I get:
Error using pulse2pda
Expected P to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
Instead its type was struct.
Error in pulse2pda (line 60)
validateattributes(P,{'numeric'},{'2d','finite','real'},fcnName,'P');
Error in pda001 (line 4)
[pdaeye,th] = pulse2pda(pulse,100000,M,DC);

回答 (2 件)

madhan ravi
madhan ravi 2020 年 6 月 19 日
[pdaeye,th] = pulse2pda(pulse.pulse,100000,M,DC);
  7 件のコメント
madhan ravi
madhan ravi 2020 年 6 月 19 日
[pdaeye,th] = pulse2pda(pulse.Vout(:), 500, M, DC);
Ariel
Ariel 2020 年 6 月 19 日
Error using pulseRecoverClock (line 98)
Hula hoop clock recovery algorithm of pulse response failed. Pulse response may be corrupted.
Error in serdes.utilities.shiftPulse (line 11)
nclockA = pulseRecoverClock( pulse(:,1), samplesPerSymbol );
Error in pulse2pda (line 86)
[P, cursorNdx]=serdes.utilities.shiftPulse(P,N);
Error in pda001 (line 4)
[pdaeye,th] = pulse2pda(pulse.Vout(:),500,M,DC);
the error it's same....

サインインしてコメントする。


Ajit Kasturi
Ajit Kasturi 2020 年 6 月 19 日
I assume that you have structs inside the matrix of your .mat file. If you want some element x which is a double or some other type in the struct, you can directly access by S.x If you want entire structure to be converted into array of some type, there is a function called struct2cell which converts the structure into cell array. You can test with the following example:
S.x = linspace(0,2*pi);
S.y = sin(S.x);
C = struct2cell(S)
For more information refer the following page:

カテゴリ

Help Center および File ExchangeDesign 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