how to read a numeric data in an array type?

조회 수: 1 (최근 30일)
ramesha
ramesha 2014년 4월 9일
답변: Walter Roberson 2016년 1월 4일
dear user
3750 555 10266
3750 555 0
3750 555 0
3750 555 0
3750 555 0
3750 555 0
3750 555 0
3750 555 0
3750 555 0
in the above text file i read data and take three co-ordinate like x,y&z but i want read in the form of a=[xi,yi,...xn,yn]. where i is initial point and n is the last point of x or y
  댓글 수: 1
Triveni
Triveni 2016년 1월 3일
Try to use reshape or permute command

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

답변 (1개)

Walter Roberson
Walter Roberson 2016년 1월 4일
fid = fopen('YourFile.txt', 'rt');
datacell = textscan(fid, '%f%f%*f', 'CollectOutput', 1);
fclose(fid);
a = reshape( datacell{1}.', 1, []);

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by