フィルターのクリア

How to I divide any given text file into columns,based on no. of characters.

1 回表示 (過去 30 日間)
Aditya
Aditya 2014 年 1 月 25 日
回答済み: Image Analyst 2014 年 1 月 25 日
here in my case, text should be divided into columns with no. of characters 8 as shown below :
123456781234567812345678123456781234567812345678
Please help me with the logic.

回答 (1 件)

Image Analyst
Image Analyst 2014 年 1 月 25 日
For the only situation you gave, this code will do exactly what you asked.
s = '123456781234567812345678123456781234567812345678'
columnVector1 = s(1:8)
columnVector2 = s(9:16)
columnVector3 = s(17:24)
columnVector4 = s(25:32)
columnVector5 = s(33:40)
columnVector6 = s(41:48)
If you need something different, like a 2D array, a cell array, different lengths of input strings, etc. then you should say so - completely and explicitly specify all input and output conditions and requirements. http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by