How does this error relate to strcat function (Error: Index exceeds matrix dimensions)?
显示 更早的评论
I am using the following code to import files from a url. I have created the file name so that it changes as my inputs change. Both of these strcat lines worked until I commented the lines at the bottom (17,18,19) since they were causing problems. Then, I got the Index exceeds matrix dimensions error for line 13 & 14. I retyped 13 and it worked, but the same solution did not fix line 14. Any idea why it is giving me this error?

回答(1 个)
dpb
2013-6-15
Actually, otomh I don't see why that particular error message w/o the actual session to poke around in to see specifics at the time but...
I'd change it up a little anyways to something more on the order of
fn=sprintf('ElementID_%d_Run_%d', id_str,rid_str);
url=sprintf([url_base 'elementid=%d&runid=&variables=...'],id_str,rid_str);
I'd also probably use more variables as intermediaries in the format string as opposed to the literal strings to make the building of the overall string a little simpler but that's purely a matter of style and choice.
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!