Info

This question is closed. Reopen it to edit or answer.

How can I match my subscripted assignment dimensions?

1 view (last 30 days)
I'm trying to retrieve multiple securities from Yahoo! by using a loop then storing the results in a matrix. However, I keep encountering the error, "Subscripted assignment dimension mismatch." How can I fix this?
Here is my script:
c = yahoo;
ticker = {'GOOG' 'IBM' 'TWTR'};
fromdate = { 735766, 735767, 735783};
todate = { 735783,735783,735783};
for i = 1:3
Price.(ticker{i}) = fetch (c,ticker(i),'Adj Close',fromdate{i},todate{i});
temp = Price.(ticker{i});
ClosePrice(:,i) = temp (:,2);
end
EDU>> extwo
Subscripted assignment dimension mismatch.
Error in extwo (line 10)
ClosePrice(:,i) = temp (:,2);
Any help would be great! Thanks,
Matt

Answers (0)

Community Treasure Hunt

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

Start Hunting!