I 've scouring the web to find a solution but not much success
p = [{2323}]; k = {'hello'};
where I want pk = {'2323hello'}
Pretty much what the concatenate function in excel would do.
Thanks, Stephan
Best Answer
One of the issues you will face here is that what is stored in the cell arrayp is numeric data and concatenation of numeric data with character arrays will convert the numeric value to its ASCII representation.
>> A = [2323,'hello']
A =
ओhello
This is not what you are looking for. So, you need to convert the number to a character array usingnum2str:
>> A = [num2str(2323),'hello']
A =
2323hello
Now if this data is stored in cells we can simply concatenate the contents (which are the char arrays):
p = {2323}; % Brackets around {} are not necessary.
k = {'hello'};
A = {[num2str(p{:}),k{:}]}; % Convert num to a string, concatenate, place back in cell
If we were then to presume that these variables had a larger (but equal) size:
Best Answer