How to create a directory using mobile number of a particular username..

조회 수: 2 (최근 30일)
Maruthi Maruthi
Maruthi Maruthi 2017년 3월 28일
댓글: KSSV 2017년 3월 31일
I need how to create a directory with the name of user's mobile number. suppose the user mobile number is 8511356595. the same number must be a foldername of that user to differentiate the next user. when I'm getting this mobile number from the database it is displaying like this [8.5114e+09]. When I create a folder using mkdir command, asking argument must be a string... Please help me.....

답변 (2개)

Guillaume
Guillaume 2017년 3월 28일
편집: Guillaume 2017년 3월 28일
Well, obviously, you need to convert the number to a string, which can be done with any of the many functions that do it:
foldername = sprintf('%d', mobilenumber);
or
foldername = num2str(mobilenumber);
or
foldername = compose('%d', mobilenumber);
Also, read about the format command which changes how the numbers are displayed in the command window only, not how they're stored.
  댓글 수: 1
Maruthi Maruthi
Maruthi Maruthi 2017년 3월 31일
I use the above code in my program, I'm getting the error..
Undefined function 'abs' for input arguments of type 'cell'.
Error in num2str (line 65)
xmax = double(max(abs(widthCopy(:))));
Error in Image_mag1/callback (line 50)
fname = num2str(fname) ;
Error while evaluating image ButtonDownFcn

댓글을 달려면 로그인하십시오.


KSSV
KSSV 2017년 3월 28일
편집: KSSV 2017년 3월 28일
num = 8511356595 ;
format long g ; % this is optional
fname = num2str(num) ;
mkdir(fname)
  댓글 수: 2
Maruthi Maruthi
Maruthi Maruthi 2017년 3월 31일
In the above code, I get full mobile number from the database and still I'm not able to create folder name with the mobile number, because mkdir accpeting only a string instead of mobile number... please help me. how can I create mobile number as a directory name...
KSSV
KSSV 2017년 3월 31일
The code which I gave it should work...Show what you tried?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by