필터 지우기
필터 지우기

Problem with file text size in bytes

조회 수: 1 (최근 30일)
wissa amer
wissa amer 2013년 6월 30일
in GUI MATLAB HOW I CAN FIND THE SIZE OF THE FILE TEXT AFTER IMPORT THIS FILE BY THIS CODE :
[file,path] = uigetfile('*.txt','Select file');
var=strcat(file,path);
file=dlmread(var);
------------------------------
and i used this code to read the file text
[filename,pathname] = uiputfile( ...
{'*.txt','save as'});
var=strcat(pathname,filename);
dlmwrite(var,x);
  댓글 수: 3
wissa amer
wissa amer 2013년 6월 30일
I Mean in bytes .
Jan
Jan 2013년 7월 1일
@wissa amer: It is recommended to avoid using "path" as name of a variable, because this is an important Matlab command. Such a shadowing can cause serious troubles during debugging. The same concerns to "var", which calculates the variance.
Instead of var=strcat(file,path) the function fullfile is safer:
[fileName, pathName] = uigetfile('*.txt','Select file');
file = fullFile(pathName, fileName); % Swapped arguments!

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

답변 (1개)

Chandrasekhar
Chandrasekhar 2013년 6월 30일
편집: Chandrasekhar 2013년 6월 30일
use the command
a= dir('complete path of the file')
example: F:\Matlab\text.txt
It gives a structure with bytes as one of the field
  댓글 수: 4
Walter Roberson
Walter Roberson 2013년 7월 1일
What happens when you try to do it in your GUI?
Jan
Jan 2013년 7월 1일
Explicitly:
dirList = dir(fullfile(pathName, fileName));
fileSize = dirList.bytes;

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by