Path: news.mathworks.com!not-for-mail
From: "Sadik " <sadik.hava@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Problems making a combined array with Char and Doubles
Date: Sat, 23 May 2009 23:23:20 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 40
Message-ID: <gva0h8$kkn$1@fred.mathworks.com>
References: <gv7m59$i3h$1@fred.mathworks.com>
Reply-To: "Sadik " <sadik.hava@gmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1243121000 21143 172.30.248.38 (23 May 2009 23:23:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 23 May 2009 23:23:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1666517
Xref: news.mathworks.com comp.soft-sys.matlab:542088

Because the array elements are not of the same size, it would be good to use a cell array.

I don't know your outputs exactly, therefore I will give a close approximation here:

numberOfCodes = length(File_codes);
cellArray = cell(numberOfCodes,1);

for  k = 1:numberOfCodes
    cellArray{k} = [num2str(File_codes(k)) ' ' Co_codes(k)];
end

Something like this should work. [You will clearly need to modify the code according to your variables.]




"Laurence 12a440" <matt1234au@yahoo.com> wrote in message <gv7m59$i3h$1@fred.mathworks.com>...
> Hi
> ...snip
>  fseek(fid, StartofField, 'bof');
>     File_code=fread(fid, 1,'uint8');
>     File_codes(count,1)=File_code;
>     Filler = fread(fid, 7);
>     Co_code = fread(fid, 14,'char');
>     Co_code = char(Co_code)';
>     Co_codes(count,2) = Co_code;
> 
>     count=count+1
> ...snip
> 
> File_codes is coming out as a double (for example 123  1)
> Co_codes as a char (for example BHP ANZ )
> 
> I need to make a final array that looks like
> 123  BHP
> 1      ANZ
> 
> but I just can't get the two together, I know it will be something simple so can someone please help
> 
> Thanks