problem using vertcat command in for loop

조회 수: 3 (최근 30일)
sasan feyzi
sasan feyzi 2022년 5월 5일
편집: Jon 2022년 5월 5일
Hi, Dear friends
I have a problem using vertcat in for loop command in matlab
I have 30 matixes with several sizes named : filter1 (n,1), filter2 (k,1), filter3 (i,1), ..... , filter30 (r,1)
,that i want to concatenate them in one column with vertcat command
Could any one help me?
  댓글 수: 2
Stephen23
Stephen23 2022년 5월 5일
편집: Stephen23 2022년 5월 5일
"I have 30 matixes with several sizes named : filter1, filter2, filter3, ..... , filter30"
And that is the start of your problems.
"that i want to concatenate them in one column with vertcat command"
That would be easy if you had stored your data in one cell array instead of thirty separate variables.
Then you could simply do this:
V = vertcat(C{:})
"Could any one help me?"
The best place to fix this is when you get them into the workspace: are the LOADed from files?
Jon
Jon 2022년 5월 5일
편집: Jon 2022년 5월 5일
Probably is an issue with the dimension of you matrices not being compatible for vertical concatentation. They all need to have the same number of columns. Hard to tell the exact problem though without seeing the specifcs of what you are trying to do. Please attach a self contained example of your code you have that produces the problem and the full text of the error message(s) you are getting

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

답변 (0개)

카테고리

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