What is the "M- notation" and where is it documented? - special-characters

The man page of cat says:
-v, --show-nonprinting
use ^ and M- notation, except for LFD and TAB
What is the M- notation and where is it documented?
Example:
$cat log -A
wrote 262144 bytes from file test.x in 9.853947s (25.979 KiB/s)^M$
^M> ^H^H ^H^H>
What do ^M and ^H mean?

I was wondering this too. I checked the source but it seemed easier to create a input file to get the mapping.
I created a test input file with a Perl scrip for( my $i=0 ; $i < 256; $i++ ) { print ( sprintf( "%c is %d %x\n", $i, $i ,$i ) ); } and then ran it through cat -v
Also if you see M-oM-;M-? at the start of a file it is the UTF-8 byte order mark.
Scroll down through these to get to the M- values:
^# is 0 0
^A is 1 1
^B is 2 2
^C is 3 3
^D is 4 4
^E is 5 5
^F is 6 6
^G is 7 7
^H is 8 8
(9 is tab)
(10 is NL)
^K is 11 b
^L is 12 c
^M is 13 d
^N is 14 e
^O is 15 f
^P is 16 10
^Q is 17 11
^R is 18 12
^S is 19 13
^T is 20 14
^U is 21 15
^V is 22 16
^W is 23 17
^X is 24 18
^Y is 25 19
^Z is 26 1a
^[ is 27 1b
^\ is 28 1c
^] is 29 1d
^^ is 30 1e
^_ is 31 1f
...printing chars removed...
^? is 127 7f
M-^# is 128 80
M-^A is 129 81
M-^B is 130 82
M-^C is 131 83
M-^D is 132 84
M-^E is 133 85
M-^F is 134 86
M-^G is 135 87
M-^H is 136 88
M-^I is 137 89
M-^J is 138 8a
M-^K is 139 8b
M-^L is 140 8c
M-^M is 141 8d
M-^N is 142 8e
M-^O is 143 8f
M-^P is 144 90
M-^Q is 145 91
M-^R is 146 92
M-^S is 147 93
M-^T is 148 94
M-^U is 149 95
M-^V is 150 96
M-^W is 151 97
M-^X is 152 98
M-^Y is 153 99
M-^Z is 154 9a
M-^[ is 155 9b
M-^\ is 156 9c
M-^] is 157 9d
M-^^ is 158 9e
M-^_ is 159 9f
M- is 160 a0
M-! is 161 a1
M-" is 162 a2
M-# is 163 a3
M-$ is 164 a4
M-% is 165 a5
M-& is 166 a6
M-' is 167 a7
M-( is 168 a8
M-) is 169 a9
M-* is 170 aa
M-+ is 171 ab
M-, is 172 ac
M-- is 173 ad
M-. is 174 ae
M-/ is 175 af
M-0 is 176 b0
M-1 is 177 b1
M-2 is 178 b2
M-3 is 179 b3
M-4 is 180 b4
M-5 is 181 b5
M-6 is 182 b6
M-7 is 183 b7
M-8 is 184 b8
M-9 is 185 b9
M-: is 186 ba
M-; is 187 bb
M-< is 188 bc
M-= is 189 bd
M-> is 190 be
M-? is 191 bf
M-# is 192 c0
M-A is 193 c1
M-B is 194 c2
M-C is 195 c3
M-D is 196 c4
M-E is 197 c5
M-F is 198 c6
M-G is 199 c7
M-H is 200 c8
M-I is 201 c9
M-J is 202 ca
M-K is 203 cb
M-L is 204 cc
M-M is 205 cd
M-N is 206 ce
M-O is 207 cf
M-P is 208 d0
M-Q is 209 d1
M-R is 210 d2
M-S is 211 d3
M-T is 212 d4
M-U is 213 d5
M-V is 214 d6
M-W is 215 d7
M-X is 216 d8
M-Y is 217 d9
M-Z is 218 da
M-[ is 219 db
M-\ is 220 dc
M-] is 221 dd
M-^ is 222 de
M-_ is 223 df
M-` is 224 e0
M-a is 225 e1
M-b is 226 e2
M-c is 227 e3
M-d is 228 e4
M-e is 229 e5
M-f is 230 e6
M-g is 231 e7
M-h is 232 e8
M-i is 233 e9
M-j is 234 ea
M-k is 235 eb
M-l is 236 ec
M-m is 237 ed
M-n is 238 ee
M-o is 239 ef
M-p is 240 f0
M-q is 241 f1
M-r is 242 f2
M-s is 243 f3
M-t is 244 f4
M-u is 245 f5
M-v is 246 f6
M-w is 247 f7
M-x is 248 f8
M-y is 249 f9
M-z is 250 fa
M-{ is 251 fb
M-| is 252 fc
M-} is 253 fd
M-~ is 254 fe
M-^? is 255 ff

^M is for Control-M (a carriage return), ^H for Control-H (a backspace). M-Something is Meta-Something (Meta- is what the Alt key does in some terminals).

I am not sure about the M- notation, but the ones involving ^ uses the caret notation:
Caret notation is a notation for control characters in ASCII.
In particular,
The digraph stands for the control character whose ASCII code is the
same as the character's ASCII code with the uppermost bit, in a 7-bit
encoding, reversed.
which you can verify by looking at the ASCII binary (octal) representation:
Image source: http://www.asciitable.com
Because ASCII is such a limited character set (as you can see above), it's straightforward to list all control chars representable by the caret notation, e.g., http://xahlee.info/comp/unicode_character_representation.html.

You can see the definition in the key_name(3) manpage
Likewise, the meta(3X) function allows the caller to change the output of keyname, i.e., it determines whether to use the “M-” prefix for “meta” keys (codes in the range 128 to 255). Both use_legacy_coding(3X) and meta(3X) succeed only after curses is initialized. X/Open Curses does not document the treatment of codes 128 to 159. When treating them as “meta” keys (or if keyname is called before initializing curses), this implementation returns strings “M-^#”, “M-^A”, etc.
key_name(3X)
So basically the Meta analog of the Ctrl version is the keycode of Ctrl + 128. You can see that easily in Brian's table. Here's a slightly modified version for ease of comparison
$ LC_ALL=C perl -e 'for( my $i=0 ; $i < 128; $i++ ) {
print ( sprintf( "%c is %d %x\t\t%c is %d %x\n",
$i, $i, $i, $i + 128, $i + 128, $i + 128 ) );
}' >bytes.txt
$ cat -v bytes.txt
^# is 0 0 M-^# is 128 80
^A is 1 1 M-^A is 129 81
^B is 2 2 M-^B is 130 82
^C is 3 3 M-^C is 131 83
...
^Y is 25 19 M-^Y is 153 99
^Z is 26 1a M-^Z is 154 9a
^[ is 27 1b M-^[ is 155 9b
^\ is 28 1c M-^\ is 156 9c
^] is 29 1d M-^] is 157 9d
^^ is 30 1e M-^^ is 158 9e
^_ is 31 1f M-^_ is 159 9f
is 32 20 M- is 160 a0
! is 33 21 M-! is 161 a1
" is 34 22 M-" is 162 a2
# is 35 23 M-# is 163 a3
$ is 36 24 M-$ is 164 a4
% is 37 25 M-% is 165 a5
& is 38 26 M-& is 166 a6
' is 39 27 M-' is 167 a7
( is 40 28 M-( is 168 a8
) is 41 29 M-) is 169 a9
* is 42 2a M-* is 170 aa
+ is 43 2b M-+ is 171 ab
, is 44 2c M-, is 172 ac
- is 45 2d M-- is 173 ad
. is 46 2e M-. is 174 ae
/ is 47 2f M-/ is 175 af
0 is 48 30 M-0 is 176 b0
1 is 49 31 M-1 is 177 b1
...
: is 58 3a M-: is 186 ba
; is 59 3b M-; is 187 bb
< is 60 3c M-< is 188 bc
= is 61 3d M-= is 189 bd
> is 62 3e M-> is 190 be
? is 63 3f M-? is 191 bf
# is 64 40 M-# is 192 c0
A is 65 41 M-A is 193 c1
B is 66 42 M-B is 194 c2
...
Z is 90 5a M-Z is 218 da
[ is 91 5b M-[ is 219 db
\ is 92 5c M-\ is 220 dc
] is 93 5d M-] is 221 dd
^ is 94 5e M-^ is 222 de
_ is 95 5f M-_ is 223 df
` is 96 60 M-` is 224 e0
a is 97 61 M-a is 225 e1
b is 98 62 M-b is 226 e2
...
z is 122 7a M-z is 250 fa
{ is 123 7b M-{ is 251 fb
| is 124 7c M-| is 252 fc
} is 125 7d M-} is 253 fd
~ is 126 7e M-~ is 254 fe
^? is 127 7f M-^? is 255 ff
The part after M- on the right is exactly the same as on the left, with the keycodes differ by 128
You can also check cat's source code, the basic expression is *bpout++ = ch - 128; for the Meta key version in the show_nonprinting case

Answer from the book.
Unix power tools.
25.7 Show Non-Printing Characters with cat -v or od -c.
"cat -v has its own symbol for characters outside the ASCII range with their high bits set, also called metacharacters. cat -v prints those as M- followed by another character. There are two of them in the cat -v output: M-^? and M-a . To get a metacharacter, you add 200 octal. "Say what?" Let's look at M-a first. The octal value of the letter a is 141. When cat -v prints M-a , it means the character you get by adding 141+200, or 341 octal. You can decode the character cat prints as M-^? in the same way. The ^? stands for the DEL character, which is octal 177. Add 200+177 to get 377 octal. "

Related

perl replace non UTF-8 characters or binary contents with whitespace

I have a file with non-ascii characters.
$ org od -t c -t x1 -A d tmp.txt
0000000 S o - c a l l e d 217 204 l a b
53 6f 2d 63 61 6c 6c 65 64 f4 8f b1 84 6c 61 62
0000016 e l e d 217 204 p a t t e r n s
65 6c 65 64 f4 8f b1 84 70 61 74 74 65 72 6e 73
0000032 217 204 c a n b e 217 204 u s
f4 8f b1 84 63 61 6e 20 62 65 f4 8f b1 84 75 73
0000048 e d 217 204 w i t h 217 204 s i
65 64 f4 8f b1 84 77 69 74 68 f4 8f b1 84 73 69
0000064 n g l e , 217 204 d o u b l e
6e 67 6c 65 2c 20 f4 8f b1 84 64 6f 75 62 6c 65
0000080 , 217 204 a n d 217 204 t r i
2c 20 f4 8f b1 84 61 6e 64 f4 8f b1 84 74 72 69
0000096 p l e 217 204 b l a n k s .
70 6c 65 f4 8f b1 84 62 6c 61 6e 6b 73 2e
As you can see, \x{f4}\x{8f}\x{b1}\x{84} has several occurrences. I want to replace \x{f4}\x{8f}\x{b1}\x{84} with whitespace. According to this, I try:
s/\x{f4}\x{8f}\x{b1}\x{84}/ /g;
tr/\x{f4}\x{8f}\x{b1}\x{84}/ /;
It doesn't work.
But if I remove this two lines in the script:
use utf8;
use open qw( :std :encoding(UTF-8) );
It works. Why?
I suspect that it is because perl only deals with characters, but \x{f4}\x{8f}\x{b1}\x{84} is not regarded as a character. Is there a way to remove \x{f4}\x{8f}\x{b1}\x{84} or any other binary contents or non UTF-8 characters with perl?
While the file may contain "\x{f4}\x{8f}\x{b1}\x{84}", your string contains "\x{10FC44}" — "\N{U+10FC44}" if you prefer — because you decoded what you read. As such, you'd need
tr/\N{U+10FC44}/ /
It's a private-use Code Point. To replace all 137,468 private-use Code Points, you can use
s/\p{General_Category=Private_Use}/ /g
General_Category can be abbreviated to Gc.
Private_Use can be abbreviated to Co.
General_Category= can be omitted.
So these are equivalent:
s/\p{Gc=Private_Use}/ /g
s/\p{Private_Use}/ /g
s/\p{Co}/ /g
Co makes me think of "control", so maybe it's best to avoid that one. (Controls characters are identified by the Control aka Cc general category.)

Keras LSTM: modeling the layers

I'm new to Keras LSTM and I building a script for prediction based on time series.
I have the data set below which describe users' power consumption in a year
User mai/13 jun/13 jul/13 ago/13 set/13 out/13 nov/13 dez/13 jan/14 fev/14 mar/14 abr/14
x1 88 99 108 90 86 79 83 75 80 69 75 61
x2 0 143 163 127 174 199 177 140 100 100 130 119
x3 51 50 41 42 51 48 58 53 53 37 47 41
x4 181 211 166 105 128 123 125 98 114 58 4 0
x5 173 187 180 195 211 212 231 188 193 168 166 0
x6 343 321 293 272 400 397 467 392 409 306 408 353
x7 215 150 161 148 153 130 165 166 198 166 150 148
x8 100 140 132 119 121 125 148 135 144 123 124 16
x9 197 193 181 161 201 161 227 154 176 148 171 172
x10 356 371 347 347 363 377 423 373 395 338 337 302
For each user, my script split the data in windows with size n, i.e., if n=6, user x1 will have the following dataset
88 99 108 90 86 79
99 108 90 86 79 83
108 90 86 79 83 75
90 86 79 83 75 80
86 79 83 75 80 69
79 83 75 80 69 75
83 75 80 69 75 61
I want my net to learn from the patterns of each window, so when I'm going to test it, based on a new window, it predicts a value considering the previous values.
Considering these variables:
dataset_length => number of months
dataset_dim => number of users
sequence_length => window size
The net I'm thinking about is:
1st layer: LSTM with sequence_length units, input_shape(None, 1) and return_sequences set true
2nd layer: LSTM with sequence_length*2 units and return_sequences set false
3rd layer: Dense with 1 unit
Is there anything wrong on my net layout? I'm testing the net with a little bit more data and not getting a very good result (high loss). What can I change for a better prediction? Do I need more layers?
Please let me know if you need some piece of code or the test results.

MATLAB Serial incorrectly sending values

I am trying to communicate with a StepRocker motor controller/drive using MATLAB. I have figured out how to format their commands and have been able to get it to move to many of commands. Their commands require that the values be sent in a binary format over RS-232. I started running into some issues and started using an Arduino to echo my commands.
I am currently sending the values 1 - 255 just to test sending bytes over the serial channel. I am sending it to an Arduino and reading the bytes back out of the Arduino. All numbers work except for the numbers between 128 and 159. This is problematic since some of my commands require values in this range.
MATLAB Script:
obj = instrfind; delete(obj); % cleanup any lost objects
clear; close force all; clc; % clear the workspace
sM = serial('COM2','BaudRate',9600, 'Terminator', 'CR', 'Timeout', 10);
fopen(sM);
pause(2); % give port time to open
% make list of numbers 1-255, skip 10/13 since they terminate on the
% arduino
cmd = [1:9 11:12 14:255];
% Send command and get echo
fprintf(sM,cmd);
pause(0.5); % give time for echo
echo = fscanf(sM);
uint8(echo)
fclose(sM);
After executing this script I get the following output:
ans =
Columns 1 through 22
1 2 3 4 5 6 7 8 9 11 12 14 15 16 17 18 19 20 21 22 23 24
Columns 23 through 44
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
Columns 45 through 66
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
Columns 67 through 88
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
Columns 89 through 110
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
Columns 111 through 132
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 63 63 63 63 63 63 63
Columns 133 through 154
63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
Columns 155 through 176
63 63 63 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
Columns 177 through 198
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
Columns 199 through 220
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
Columns 221 through 242
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
Columns 243 through 254
245 246 247 248 249 250 251 252 253 254 255 13
Looking at the output, you can see that the numbers between 128 and 159 all come through as 63. I am at a loss for what is causing this issue. This is very repeatable, and the problem occurs anytime there is a number in this range, no matter its position in the string, no matter the length of the serial string.
Arduino Code:
bool stringComplete = false;
String inputString = "";
void setup() {
Serial.begin(9600);
}
void loop() {
if (stringComplete) {
Serial.print(inputString);
stringComplete = false;
inputString = "";
}
}
void serialEvent() {
while (Serial.available()) {
char inChar = (char)Serial.read();
inputString += inChar;
if (inChar == '\r') {
stringComplete = true;
}
}
}
Any suggestions or ideas on how to solve this problem?

How could I have each result as a vector?

I think that I have always the same problem, vector, array and cell array, Thanks to this discussion, How can I split a Text in blocks of 16 bytes every one? I could resolve my first problem. However I still need that each result in data must be e vector in order to encrypt it.
fid = fopen('file.txt', 'r');
alldata = textscan(fid, '%s');
tmp = reshape(alldata{1}, 16, []).';
tmp = arrayfun(#(x)strjoin(tmp(x,:)), 1:size(tmp, 1), 'uniformoutput', false)
key=hex2dec(key_hex).'
data= (cat(1, tmp{:}))
for i= 1:rows(data)
Matrix(i, :)= hex_keys([data(i,1:15), data(i,16)])
chiffrement (Matrix(i,:), key,1)
endfor
endfunction
My error is: error: Plaintext has to be a vector (not a cell array) with 16 elements.
I would be very grateful if you could help me.
The file.txt contains for example:
60 3d eb 10 15 ca 71 be 2b 73 ae f0 85 7d 77 81 60 3d eb 10 15 ca 71 be 2b 73 ae f0 85 7d 77 81 60 3d eb 10 15 ca 71 be 2b 73 ae f0 85 7d 77 81
In fact, it is a big programm and succesion of function, All what i need is how to convert each line in this data result to a vector.
data =
60 3d eb 10 15 ca 71 be 2b 73 ae f0 85 7d 77 81
60 3d eb 10 15 ca 71 be 2b 73 ae f0 85 7d 77 81
60 3d eb 10 15 ca 71 be 2b 73 ae f0 85 7d 77 81
I think you are over complicating the problem, my assumptions is you want to convert your data in file.txt into numbers (i.e. you used hex2dec), so let's do just that and leave Arrayfun out of the problem:
fid = fopen('file.txt', 'r');
alldata = textscan(fid, '%s');
tmp = reshape(alldata{1}, 16, []).'; % here we still parse 16 hex for every row using your function call
tmp = cellfun(#hex2dec,tmp,'un',0) % now we use cellfun to convert all your hex to numbers
Matrix = cell2mat(tmp)
Matrix =
96 61 235 16 21 202 113 190 43 115 174 240 133 125 119 129
96 61 235 16 21 202 113 190 43 115 174 240 133 125 119 129
96 61 235 16 21 202 113 190 43 115 174 240 133 125 119 129
whos Matrix
Name Size Bytes Class Attributes
Matrix 3x16 384 double
Now you can use your for loop to do whatever you want, it becomes regular indexing.

execution of parforlop in matlab

I have sample code emulating my actual code. Where I have cell arrays outside the parfor loop. I have to perform computations on strings and numerical outputs will be stored in arrays which I can write to a csv file after each parfor loop. So I made dummy code. But I couldn't get it to execute. The error message is: "subscription mismatch at line 6".
ftemp=fopen('temp.csv','w');
march=cell(1,20);tc=0;
march={'ab' 'cd' 'ef' 'gh' 'ij' 'kl' 'mn' 'op' 'qr' 'st' 'uv' 'AB' 'CD' 'EF' 'GH' 'IJ' 'KL' 'MN' 'OP' 'QR'};
for i=1:10
matlabpool open 4;
parfor j=1:1:20
a(j,1)=randi(200,1,1);
b(j,2)=j+tc;
c(j,3)=march{1,j};
d(j,4)=(randi(200,1,1)/200);
end
fprintf(ftemp,'%d\t%d\t%s\t%f',a,b,c,d);
matlabpool close
clear a b c d;
tc=tc+20;
end
fclose(ftemp);
quit
The cause of the Error is that you are trying to assign a cell into an array in line 9.
I made some changes into your code, they are described in comments.
ftemp=fopen('temp.csv','w');
march=cell(1,20);tc=0;
march={'ab' 'cd' 'ef' 'gh' 'ij' 'kl' 'mn' 'op' 'qr' 'st' 'uv' 'AB' 'CD' 'EF' 'GH' 'IJ' 'KL' 'MN' 'OP' 'QR'};
for i=1:10
parpool local; % here in my version of Matlab 2015 there are no more "matlabpool" if it doesen't work change it back
parfor j=1:20
%i changed variable a(j,1) into a(j) and b(j,2) into b(j): may
%contain empty arrays , idem: for c and d
a(j)=randi(200,1,1);
b(j)=j+tc;
c{j}=march{1,j}; % changed c(j)= march{1,j}; : cause of error
d(j)=randi(200,1,1)/200;
end
fprintf(ftemp,'%d\t%d\t%c\t%d',a,b,char(c),d); % char(c) in order to convert cell array to array of strings
delete(gcp) % there isn't such thing "matlabpool close" , the right expression is "delete(gcp)"
clear a b c d;
tc=tc+20;
end
fclose(ftemp);
%quit : i remove because it closes matlab , please put it back if u really
%want to close matlab after operation
Note: if parpool doesent work for your version of matlab , please change it back to the expression you were using matlabpool open 4;
Well for the unexpected outputs and number of rows in the output , it's because the wrong use of fprintf . We need to print element by element , which means the fprintf has to be inside the parfor loop, so your code should look like this:
ftemp=fopen('temp.csv','w');
march=cell(1,20);tc=0;
march={'ab';'cd';'ef';'gh';'ij';'klm';'mn';'op';'qr';'st';'uv';'ABls';'CD';'E3F';'GH';'IJ';'dynaKL';'MN';'OP';'QR'};
matlabpool open 4;
for k=1:10
%parpool local; % here in my version of Matlab 2015 there are no more "matlabpool" if it doesen't work change it back
parfor j=1:20
%i changed variable a(j,1) into a(j) and b(j,2) into b(j): may
%contain empty arrays , idem: for c and d
a(j)=randi(200,1,1);
b(j)=j+tc;% indexing purposes to identify the order when parallel processing going on
if length(march{j})>2 % this kind of conditions and computations are there in my actual code
c{j}='skip';
else
c{j}=march{j};
end
%d(j)=randi(200,1,1)/200;
fprintf(ftemp,'%d\t%d\t%s\t\n',a(j),b(j),c{j}); % char(c) in order to convert cell array to array of strings
end
clear a b c;
tc=tc+20;
end
fclose(ftemp);
matlabpool close;
the output is:
9 1 ab
171 2 cd
7 3 ef
98 4 gh
102 5 ij
20 6 skip
53 7 mn
174 8 op
36 9 qr
30 10 st
130 11 uv
127 12 skip
133 13 CD
65 14 skip
118 15 GH
130 16 IJ
139 17 skip
168 18 MN
57 19 OP
25 20 QR
22 21 ab
39 22 cd
83 23 ef
22 24 gh
159 25 ij
40 26 skip
164 27 mn
78 28 op
194 29 qr
88 30 st
125 31 uv
1 32 skip
2 33 CD
112 34 skip
161 35 GH
170 36 IJ
55 37 skip
59 38 MN
18 39 OP
134 40 QR
80 41 ab
118 42 cd
108 43 ef
174 44 gh
97 45 ij
157 46 skip
85 47 mn
98 48 op
40 49 qr
11 50 st
171 51 uv
139 52 skip
90 53 CD
70 54 skip
173 55 GH
150 56 IJ
186 57 skip
155 58 MN
136 59 OP
96 60 QR
158 61 ab
118 62 cd
124 63 ef
127 64 gh
26 65 ij
124 66 skip
91 67 mn
186 68 op
63 69 qr
137 70 st
170 71 uv
98 72 skip
132 73 CD
80 74 skip
160 75 GH
20 76 IJ
156 77 skip
142 78 MN
110 79 OP
51 80 QR
18 81 ab
29 82 cd
40 83 ef
49 84 gh
102 85 ij
113 86 skip
96 87 mn
44 88 op
166 89 qr
90 90 st
21 91 uv
60 92 skip
44 93 CD
166 94 skip
103 95 GH
123 96 IJ
77 97 skip
163 98 MN
138 99 OP
111 100 QR
94 101 ab
133 102 cd
158 103 ef
13 104 gh
26 105 ij
117 106 skip
90 107 mn
58 108 op
156 109 qr
79 110 st
196 111 uv
168 112 skip
192 113 CD
160 114 skip
56 115 GH
129 116 IJ
191 117 skip
157 118 MN
170 119 OP
30 120 QR
137 121 ab
128 122 cd
12 123 ef
38 124 gh
38 125 ij
122 126 skip
97 127 mn
129 128 op
142 129 qr
154 130 st
99 131 uv
85 132 skip
129 133 CD
111 134 skip
108 135 GH
78 136 IJ
102 137 skip
48 138 MN
100 139 OP
89 140 QR
114 141 ab
12 142 cd
184 143 ef
145 144 gh
5 145 ij
48 146 skip
92 147 mn
64 148 op
87 149 qr
32 150 st
136 151 uv
103 152 skip
90 153 CD
73 154 skip
28 155 GH
191 156 IJ
63 157 skip
120 158 MN
104 159 OP
178 160 QR
148 161 ab
36 162 cd
129 163 ef
11 164 gh
172 165 ij
186 166 skip
145 167 mn
142 168 op
150 169 qr
185 170 st
14 171 uv
141 172 skip
22 173 CD
163 174 skip
48 175 GH
164 176 IJ
117 177 skip
25 178 MN
110 179 OP
111 180 QR
175 181 ab
60 182 cd
195 183 ef
44 184 gh
163 185 ij
4 186 skip
103 187 mn
95 188 op
127 189 qr
10 190 st
11 191 uv
182 192 skip
162 193 CD
179 194 skip
76 195 GH
104 196 IJ
153 197 skip
103 198 MN
4 199 OP
154 200 QR
Also the output has 200 rows.
ftemp=fopen('temp.csv','w');
march=cell(1,20);tc=0;
march={'ab';'cd';'ef';'gh';'ij';'klm';'mn';'op';'qr';'st';'uv';'ABls';'CD';'E3F';'GH';'IJ';'dynaKL';'MN';'OP';'QR'};
matlabpool open 4;
for k=1:10
%parpool local; % here in my version of Matlab 2015 there are no more "matlabpool" if it doesen't work change it back
parfor j=1:20
%i changed variable a(j,1) into a(j) and b(j,2) into b(j): may
%contain empty arrays , idem: for c and d
a(j)=randi(200,1,1);
b(j)=j+tc;% indexing purposes to identify the order when parallel processing going on
if length(march{j})>2 % this kind of conditions and computations are there in my actual code
c{j}='skip';
else
c{j}=march{j};
end
%d(j)=randi(200,1,1)/200;
end
fprintf(ftemp,'%d\t%d\t%s\n',a,b,c{:}); % char(c) in order to convert cell array to array of strings
clear a b c;
tc=tc+20;
end
fclose(ftemp);
matlabpool close;
but the output of the program i coudlnt get it
130 127 Abf5ȱ3³]À#¾
1 2

97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82 168 57 ®$ «E�,vp|}¤
21 22 !"#$%&'(
97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82 88 125 S([g 0'0Â"
41 42 +,-./0123456789:;<
97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82 161 170 7Na�U;6´q¶nl®v¤
61 62 ?#ABCDEFGHIJKLMNOP
97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82 171 139 ZF­ºPµ~R(`b[
81 82 STUVWXYZ[\]^_`abcd
97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82 132 80 ||£)Á1[ªavb-
101 102 ghijklmnopqrstuvwx
97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82 186 63 ª`neepw»fq°r1
121 122 {|}~�
97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82 51 160 M(1´uOAF¦{¬©
141 142 ��� 
97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82 90 21 <,uZgh�lu¨B,¦
0
161 162 £¤¥¦§¨©ª«¬­®¯°±²³´
97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82 192 160 o£¿^hyµÄ¨�Ä�O
181 182 ·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈ
97 98 cd
101 102 gh
105 106 skip
109 110 op
113 114 st
117 118 skip
67 68 skip
71 72 IJ
115 107 ip
77 78 OP
81 82
i mean to say why only 124 iterations took place instead of 200. and why these arbitrary outputs are there in the 3rd column