How can I add column with for loop

조회 수: 3 (최근 30일)
Atony Garcia
Atony Garcia 2020년 12월 26일
댓글: Jan 2020년 12월 26일
Hi everyone
I have this vector
url = {'nam1', 'nam2', 'nam3','nam5', 'name5', 'nam6'};
And I need to do a for loop to add to another 1x6 matriz name by name, I have tried the nexy code
for i = length(xsl)
xsl(:,i)=url;
end
but it return a 6x6 cell array and that is not what Im looking for, can anyone help me?
Thanks
  댓글 수: 1
Jan
Jan 2020년 12월 26일
What is the wanted output? What about:
xsl = cat(2, url{:})

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

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 12월 26일
The question is not clear. Are you looking for something like this
url = {'nam1', 'nam2', 'nam3','nam5', 'name5', 'nam6'};
xsl = cell(1,6);
for i = length(xsl)
xsl(:,i)=url(i);
end

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by