Reputation: 107
fid=fopen('transform.txt');
alltext = textscan(fid, '%s');
d = size(alltext)
for k=1:1
line = alltext{1}{k}
end
I am using size()
function to get the number of cells but it is not giving me my desired Answer....I want the number of cells in array variable named alltext
Transform.txt File
mecca06.pgm 2 0.707 -0.1414 0 0.707 1.2726 0 0 0 1 mecca06.pgm c
Upvotes: 0
Views: 853
Reputation: 546
If textscan finds strings it returns a cell array of one or multiple cell arrays. The number of specifiers (in your case %s) you search for defines the number of nested cell arrays it returns. Most primitive solution for your case, where you only search for %s would be:
d = size(alltext{1});
Upvotes: 1