How to connect strings in MATLAB
I try to do the following:
fname = strcat('C:\Users\user_name\work\video\',avi_name);
videoObject = VideoReader(fname);
I开发者_StackOverflow社区 get an error message:
Argument must contain a string.
I try to check what is my fname
:
fname = strcat('C:\Users\user_name\work\video\',avi_name);
fname
videoObject = VideoReader(fname);
I see that it is (as expected):
'C:\Users\user_name\work\video\bla_bla.avi'
When I try to do the following:
fname = 'C:\Users\user_name\work\video\bla_bla.avi';
videoObject = VideoReader(fname);
It works. Can anybody explain me what is wrong with the output of strcat
. Why it is not recognized as a string by the function and why it does look like a correct string in the output?
If avi_name
is a cell array, then the output of strcat
will be a cell array as well (that's why the string comes with quotation marks when you display it).
Use
fname = strcat('C:\Users\user_name\work\video\',avi_name{1});
精彩评论