0

If I perform s.device_macs then I get back a <1x3503 cell> so I would expect this as the output of my concatenate but I have 2 things I'm unsure on when I use: a = cat(2,s.device_macs)

To concatenate previously I used cat(1,x) but this doesn't work however the number 2 lets it run and the second thing is that it returns a <1x603326 cell>, obviously much larger than when I don't try and use cat().

Thanks alot, from a MATLAB newbie!

Accendi
  • 627
  • 1
  • 7
  • 15

2 Answers2

0

s.device_macs is a 1 row (first dimension) x 3503 column (second dimension) vector. That is why you have to specify 2 in cat(2,s.device_macs), so that it concatenates along the second dimension -- the columns. My guess is that the 1x603326 result is a string with 603326 characters (in columns), but not entirely sure... hopefully someone else can help here.

jpatton
  • 394
  • 3
  • 17
0

I have used a cheating method of solving this. As I mentioned the ans was coming out correct and so I decided to just use this:

s.device_macs; % This gives the answer of <1x3503 cell>
macId = ans; % I now make macId copy answer
clear ans; % Now I wipe ans leaving me with just macId

I know this isn't an efficient method of coding compared to just knowing the language but duct-tape-esque fixes are fun to find :P.

Accendi
  • 627
  • 1
  • 7
  • 15
  • Try `macId = { s.device_macs };` ? – Ben Voigt Apr 17 '12 at 17:33
  • What do these do or how do I find some help text on this just so I know why it's giving me the answer it is doing? – Accendi Apr 17 '12 at 18:37
  • My data has 106 different people in it and I think I get it, that using the `{}` curly braces creates a matrix, with seperate entries for each of the people because I can do `s(x).device_macs` where x is in 1:106 And in this case `macId = { s.device_macs };` returns it as a <1x106 cell>. Does this sound half correct? Cheers! – Accendi Apr 17 '12 at 18:51
  • 1
    `{}` doesn't create a matrix, it creates a cell array. `[]` creates a matrix. The main difference is that a matrix has to be square and have uniform type, while a cell array can be jagged and contain different types. – Ben Voigt Apr 17 '12 at 19:41