how to convert 1x2 double into two 1x1
Mostrar comentarios más antiguos
Hi I was coding when I had this error:
Time_msg_match = string(Time_msg_match);
Error using string
Conversion from cell failed. Element 61649 must be convertible to a string scalar.
>> Time_msg_match(61649)
ans =
1×1 cell array
{2×1 double}
How can I concadenate this 2x1 double?
I wrote:
Time_msg_match1 = num2str(cat(1, Time_msg_match{:}));
But the result is not what I wanted. Thanks in advance
Respuesta aceptada
Más respuestas (1)
Rik
el 23 de Oct. de 2021
It looks like this is what you want:
x=Time_msg_match(61649);
x=x{1};
7 comentarios
flashpode
el 23 de Oct. de 2021
Rik
el 23 de Oct. de 2021
Since this is a basic Matlab syntax question, I'm wondering if you are asking the question you want the answer to. But if so: of course you can:
Time_msg_match=Time_msg_match(61649);
Time_msg_match=Time_msg_match{1};
Maybe you should have a more explicit explanation of what goal you want to reach and what data you're starting with.
flashpode
el 23 de Oct. de 2021
So something like this?
a={{1,2},3,4};
[a{:}]
flashpode
el 24 de Oct. de 2021
Image Analyst
el 24 de Oct. de 2021
@vicente Noguer, did you overlook my request?
Also, a specific numerical example using the first 2 or 3 rows of your cell array would be helpful. Help us to help you.
Rik
el 24 de Oct. de 2021
You are ignoring the advice that Image Analyst is giving you. That is not smart.
Also, did you try making a it a double array instead of a cell? You will notice that my code will still do something usefull. It brings you only a single step away from the array you need.
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!