필터 지우기
필터 지우기

Subscripted assignment dimension mismatch.

조회 수: 2 (최근 30일)
fede
fede 2016년 3월 14일
편집: Walter Roberson 2016년 3월 14일
Hi
I have the vector price <1xn struct> in which we have a several information about a price of a stock. I want to have a vector in which we have all tickers name of the stock, with the following:
nome=zeros(size(price));
for t=1:size(price,2);
nome(1,t)= price(1, t).Ticker;
end
but I have the error: Subscripted assignment dimension mismatch.

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 14일
It is not possible to have a vector of strings in MATLAB, because strings are really vectors of characters. You will need to use cell arrays of strings:
nome{1,t} = price(1, t).Ticker;
  댓글 수: 4
fede
fede 2016년 3월 14일
편집: Walter Roberson 2016년 3월 14일
yeah but with the following code
for t=1:size(price,2);
nome(1,t)= price(1, t).Ticker;
end
i obtain only a cell of 1x1, indeed 1xn
fede
fede 2016년 3월 14일
I have solved it thx

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by