First, sorry if my english is not perfect.
I am using Matlab to generate a waveform and to create a binary file (based on on waveform points) which I want to send to an Agilent 33522A Function Generator to generate an arbitrary waveform. My problem is that my binary file generated in my computer contains "\r\n" characters, and when try to download data in 33522a it ends up with an error. I tried to change the EOSCharacter, but it is replaced wherever \n is found in my binary file.
If I generate the binary file so that all data is contaned in one line, I could send the data, but some information like, sample rate, number of samples and maximum /minimum voltage are not read by the Function Generator.
My binary file is something like that:
Line 1
Line 2
Line 3
Data:
integer value 1
intege value 2
...
I played with EOI mode, EOS mode and EOS Characther but I didn't succeeded to write in memory of Agilent 33522A a file with data written on more than one line;
If I put my data in a USB Stick, the binary file is correctly read by the aparat, even it contains \r\n character at the end of each line.
Any ideas on how to send thru GPIB a binary file which contains multiple CR and LF \r\n characters?
You have to set the EOSMode to 'write' by:
set(yourdevice_Obj,'EOSMode','write')
and leave the EOSCharacter as LF (\n).
an.
Related
I'm trying to accomplish following task in Octave:
Read filename from text file
Search for this file in particular location on hard drive
My script works for most files, but for certain files containing unicode characters I'm unable to match the filename from textfile with filename as it appears in the file system.
Filenames in textfile are in UTF-8 encoding and I read them in Octave with function fgetl().
Filenames from file system are obtained via function readdir(). I'm on Windows, NTFS file system.
For example, one problematic filename contains character "Č".
When printed out in Octave console, the characters appear exactly the same. However, a HEX viewer reveals that the characters are not actually the same. In the first case the character is encoded as 0x010C, in the second case as 0x0043 + 0x030C. Comparing both of them via strcmp() fails, of course.
What I tried to do is to omitt all non-ASCII characters from the filename and then compare them. But this didn't work, probably because in the second variant the first part of the character (0x0043) is actually ASCII.
Now I'm looking for some way of converting one format to another to be able to compare them. Any ideas?
EDIT:
As I discovered later, the character Č in the filename on Windows is actually written as C+ˇ, which is just another way you can write that character. So the difference probably insn't in encoding standard, but in 2 different ways to achieve 1 visible character (glyph).
This question basically then changes to a task of matching characters written "at once" and corresponding pair of letter+combining character.
I am using the https://hevc.hhi.fraunhofer.de/svn/svn_HEVCSoftware/tags/HM-16.9 version of the H265 video encoder, and used it to generate a TraceDec.txt file which contains VPS, PPS, PPS, and slice header symbols (e.g vps_video_parameter_set_id u(4): 0)
I was told to match the bits of the .265 file with the symbols of the TraceDec.txt file using a hex editor. I opened the .265 file with a hex editor, but I have no clue how these bits correspond to the symbols in the trace file. The manual doesn't seem to help, either. Do the first bits of the file even start with the VPS?
I'm new to matlab programming.I have an image processing code which helps to load a mat file in it. the code accepts .mat file as input with video file in it.
filename=('C:\Users\HP\Desktop\Folder\Image\NVR_ch2_main_cut_35-41.asf');
s=load(filename);
s=struct2cell(s);
M=double(s{1});
if (length(size(M))==4)
M=squeeze(M(:,:,1,:));
end`
Error using load
Unknown text on line number 1 of ASCII file C:\Users\HP\Desktop\Folder\Image\NVR_ch2_main_cut_35-41.asf
"Seh".
Just use v = VideoReader(filename) instead of the load function.
For further information: http://ch.mathworks.com/help/matlab/ref/videoreader.html
Well obviously Matlab won't read your file because it contains things load won't accept.
Does your file comply to this: (from the Matlab reference , next time you should read this)
ASCII files must contain a rectangular table of numbers, with an equal
number of elements in each row. The file delimiter (the character
between elements in each row) can be a blank, comma, semicolon, or tab
character. The file can contain MATLAB comments (lines that begin with
a percent sign, %).
http://de.mathworks.com/help/matlab/ref/load.html#responsive_offcanvas
Read your first sentence. You say you want to load a .mat file. But filename ends with .asf which is some video format if I remember correctly.
You can't feed a video file into load.
I have two data text files with the same text content but they have different sizes. The following snapshot compares them (using Beyond Compare).
It seems that the hex content of the files is different.
The MATLAB function importdata reads fine the file to the left but gives the following error with the file to the right (the bigger size file):
Unable to load file. Use TEXTSCAN or FREAD for more complex formats.
What exactly is the difference between the two files ?
How to make importdata work with the file to the right ?
The problem and solution is already mentioned in the comments:
it seems like one text file is in ascii encoding (that is 8 bits per char) while the second one is unicode (16 bits per char). try converting the big file into simple ascii and re-read it
You may see the difference already in BeyondCompare: On the left, you have an ANSI-File, on the right you have a unicode with BOM (The hex-code looks like UTF-16LE. I'm not sure, which version the BeyondCompare you used to get the screenshot. My BeyondCompare would not show 'Unicode' but 'UTF16-LE' ...).
I am using the fprintf command to store the contents of a .mat file to a .txt. The .mat file contains strings. My code prints the data in the same column.
fid = fopen('exp.txt','wt');
for i=1:275
fprintf (fid,classes{i}{1})
end
fclose(fid);
When I use the \n and the '\r\n' options, they doesn't print anything to the file. I'd appreciate the help!
Some text editors will show those new line characters and some wont. This happens because of different standards followed by different softwares and operating systems for eg:
end of line sequences
Windows end of line sequence: \r\n
Unix end of line sequence: \n
Mac end of line sequence: \r
So if you really want good human readable formats, either fix your operation system/software and use characters friendly for that system, or if you want uniformity in the reports, better write files in standard HTML formats :)
adding a "br" tag and naming file .html is as simple as writing out '\n' and naming it .txt!