what is the "count" mean?

1 view (last 30 days)
ati fayazan
ati fayazan on 18 Nov 2021
Commented: ati fayazan on 18 Nov 2021
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);

Answers (1)

KSSV
KSSV on 18 Nov 2021
Edited: KSSV on 18 Nov 2021
[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 Comment
ati fayazan
ati fayazan on 18 Nov 2021
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');

Sign in to comment.

Categories

Tags

Community Treasure Hunt

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

Start Hunting!