what is the "count" mean?

조회 수: 6 (최근 30일)
ati fayazan
ati fayazan 2021년 11월 18일
댓글: ati fayazan 2021년 11월 18일
hi
What do these commands do? please
what is "count"?
[v1,count]=fscanf(fid,'%f',[2,numpt]);
fclose(fid);
v1=v1';
code=v1(:,2);
code_count=zeros(1,2^numbit);

답변 (1개)

KSSV
KSSV 2021년 11월 18일
편집: KSSV 2021년 11월 18일
[v1,count]=fscanf(fid,'%f',[2,numpt]); % reading data from the file into 2 rows and numpt coulmns; count gives you total numbers read into v1
fclose(fid); % closing the file
v1=v1'; % transpose
code=v1(:,2); % pick second column
code_count=zeros(1,2^numbit);
Check numel(v1) and count, they should be equal.
  댓글 수: 1
ati fayazan
ati fayazan 2021년 11월 18일
thanks
I found these commands to output an ADC to MATLAB. Do you know if the ADC outputs it needs to get are just the bits or not? If not, what is the meaning of v 1?Please
<disp('HP16500C State Card');
filename=input(
'Type a:\filename or Press RETURN for HPIB Data Transfer: ');
if isempty(filename)
filename =
'listing';
end
fid=fopen(filename,'r');
numpt=input(
'Data Record Size (Number of Points)? ');
fclk=input(
'Sampling Frequency (MHz)? ');
%MAX1448 - 10-bit data converter
numbit=10;
%Discard first 13 lines from the data file, which do not contain data
for i=1:13,
fgetl(fid);
end
[v1,count]=fscanf(fid,'%f',[2,numpt]);
fclose(fid);
v1=v1';
code=v1(:,2);
%Display a warning, when the input generates a code greater than full-scale
if (max(code)==2^numbit-1) | (min(code)==0)
disp('Warning: ADC may be clipping!!!');
end
%Plot results in the time domain
figure;
plot([1:numpt],code);
title('TIME DOMAIN')
xlabel('SAMPLES');
ylabel('DIGITAL OUTPUT CODE');

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

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by