Basic Matlab Question, Urgent!! Please help!

Status
Not open for further replies.

ahmad_abdulghany

Advanced Member level 4
Joined
Apr 12, 2005
Messages
1,206
Helped
102
Reputation
206
Reaction score
22
Trophy points
1,318
Location
San Jose, California, USA
Activity points
11,769
Hello,

I have a variable got from the function: fgetl() , that variable contains rows like this:

a= 12345 6789

it contains many rows like the above, but it's not a two columns vector, but many columns,

when I type:
Code:
>> a' % to get the transpose of it
ans
1
2
3
4
5


6
7
8
9
>>

I want when i type a' it prints:
12345
6789

i.e. convert each batch of separate digits (or they're actually characters) into one number

Please help me ,
Thanks in advance,
Ahmad,
 

Hi Ahmad,

I still have difficulty to understand your real goal, so i'm sorry if my answer is not what you are looking for.

As you wrote at the end of your posting, i.e. you need to convert each batch of characters into one number, then maybe you need the matlab built-in str2num(). Please see the help on that function in matlab.

best
 

Yeah!!
It solved the problem!! it was really what i want,

I did it via the str2num() function, as follows:
Code:
>>a='12345   6789';
>>b=str2num(a);
>>b'
ans
12345 
6789
>>

Check this link, it contains the original problem and it's now solved,


Regards,
Ahmad,
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…