double Conversion to double from struct is not possible.

Error using ==> double
Conversion to double from struct is not possible.
clc;
clear all;
x = load('S_chest.mat');
y = load('S_abdomen.mat');
A=zeros(size(x));
A(1,1)=x(1);
for n= 2:5955
A(n,1)=x(n);
A(n,2)=x(n-1);
end
What's wrong with that?

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2017년 9월 4일
편집: Andrei Bobrov 2017년 9월 5일
x1 = load('S_chest.mat');
y1 = load('S_abdomen.mat');
x = x1.x;
y = y1.y;
A=zeros(size(x));
A(1,1)=x(1);
for n= 2:5955
A(n,1)=x(n);
A(n,2)=x(n-1);
end
or
x1 = load('S_chest.mat');
x = x1.x;
n = numel(x);
k = 5955;
A = toeplitz([x(1:k);zeros(n - k,1)],[x(k) 0]);
A(k+1,2) = 0;

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2017년 9월 4일

편집:

2017년 9월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by