Subscripted assignment dimension mismatch.

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일

0 개 추천

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일
thanks, but now give me the following error: Cell contents assignment to a non-cell array object.
Did you clear nome before you tried that? You might have a version of nome left over from before.
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개)

카테고리

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

질문:

2016년 3월 14일

편집:

2016년 3월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by