for example i have matrix size 5x3, i want to increase size of matrix became 10x3.
example my data :
A = [997.400000000000 -1.10000000000000 70.4000000000000
997.500000000000 -1 70
997.600000000000 -1.50000000000000 72
997.700000000000 -1.80000000000000 73.2000000000000
997.800000000000 -1.80000000000000 73.6000000000000]
I want to my data like this :
A = [997.400000000000 -1.10000000000000 70.4000000000000
NaN NaN NaN
997.500000000000 -1 70
NaN NaN NaN
997.600000000000 -1.50000000000000 72
NaN NaN NaN
997.700000000000 -1.80000000000000 73.2000000000000
NaN NaN NaN
997.800000000000 -1.80000000000000 73.6000000000000
NaN NaN NaN ]
How to i solve this in Matlab....
Thanks you very much for the helping.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2013년 10월 10일
편집: Andrei Bobrov 2013년 10월 10일

1 개 추천

s = size(A);
P = cat(3,A,nan(s));
out = reshape(permute(P,[2 3 1]),s(2),[]).';
or
out = nan(size(A).*[2 1]);
out(1:2:end,:) = A;

댓글 수: 1

Innosens
Innosens 2013년 10월 10일
Thanks you very much.... your suggestion is working very well

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jos (10584)
Jos (10584) 2013년 10월 10일

0 개 추천

Take a look at INSERTROWS:
insertrows(A,NaN,1:size(A,1))

댓글 수: 1

Innosens
Innosens 2013년 10월 10일
I have try this function, it is working very well.... Thank you very much......

댓글을 달려면 로그인하십시오.

카테고리

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

태그

질문:

2013년 10월 10일

댓글:

2013년 10월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by