I'm really new to matlab programming and I can't figure something out. I spent hours googling and no luck. I'm trying to make an app that will take a text file convert it to binary and then convert the binaries to hamming code. That's the first part the rest isn't important for this question.
The GUI is printing out my output in a column, and I want it to print it out in a row. The variable is printed out in a row normally, but in the GUI it's printed out in a column...
The program takes the text from the txt file converts every character to a binary digit and the I make cells for each characters digit which are then put into a function that does the hamming encoding. So the output is a cell array.
This is the main part of the program:
[filename pathname] = uigetfile({'*.txt'}, 'File Selector');
fullpathname = strcat(pathname, filename);
text = fileread(fullpathname);
set(handles.text1, 'String', fullpathname)
binarno = dec2bin(text, 8);
L = length(text);
C = num2cell(binarno,2)
D = cellfun(@enkoder, C,'uniformoutput', 0)
set(handles.text2, 'String', D)
I tried a lot of stuff, and nothing worked. I don't know why it prints out the cell arrays D in a column.. instead of a row. If I try D{1}
I normally get a row of the hamming code.
And this part of the enkoder function:
function hamm = enkoder(ulaz)
%the hamming encoding part of the code goes here
hamm = [prva_pozicija, druga_pozicija, jedan, cetvrta_pozicija,
dva, tri, cetiri, osma_pozicija ,pet, sest, sedam, osam]
%this is the output from the code
So I guess the questions is how do I print out a cell array in rows in a GUI label ?
Using [D{:}]
instead of D
in last line may help.
edit: use num2str(cell2mat(D))
instead