How to connect all result?

조회 수: 1 (최근 30일)
Kris Sarikanoppakhun
Kris Sarikanoppakhun 2021년 4월 1일
댓글: Kris Sarikanoppakhun 2021년 4월 3일
Hello guys,I'm very new in matlab.
I have some problem about for loop it show result just only the lastest calculation so how should i do to show all result in one tine
for i=0:bond(860) %bond is data that include 860*2 table
a=[bond(i+1,:)];
B=[repmat(a(1),[length(nonzeros(a))-1 1]) nonzeros(a(2:end)')]
end
%I just want to connect all result together thank you.

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021년 4월 1일
편집: KALYAN ACHARJYA 2021년 4월 1일
Use cell array to store the vectors
B=cell(1,bond(860)+1)
for i=1:bond(860)+1 %bond is data that include 860*2 table
a=[bond(i+1,:)];
B{i}=[repmat(a(1),[length(nonzeros(a))-1 1]) nonzeros(a(2:end)')]
end
B
Also see cell2mat function (If Needed)
  댓글 수: 1
Kris Sarikanoppakhun
Kris Sarikanoppakhun 2021년 4월 3일
Thank you for your help Mr.Kalyan :)

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by