フィルターのクリア

how to transpose gui data ?

1 回表示 (過去 30 日間)
Tayyaba Abro
Tayyaba Abro 2021 年 2 月 13 日
回答済み: Walter Roberson 2021 年 2 月 14 日
I am reading excel file and showing data on GUI. My data is shown vertically but I want it horizontally. I tried to transpose it but it still showing vertically. How can I do that ? Please help.
here is my code:
[~,~,icd]=xlsread('icd.xlsx','Sheet1','B4:B21');
bytes=transpose(icd)
set(handles.packet,'String',bytes)
ouptut
  2 件のコメント
Jan
Jan 2021 年 2 月 13 日
What is the contents of "icd"? What is the wanted output?
Tayyaba Abro
Tayyaba Abro 2021 年 2 月 14 日
content of icd is same as it is shown in output as it is shown in 1 column I want to be in 1 row.

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 2 月 14 日
Your icd is currently a cell array of character vectors, and is being displayed to a uicontrol style 'text' or style 'edit' in which Max has been set to at least 2 (otherwise you would have received an error.)
When you set the String property of a uicontrol text or edit to a cell array of character vectors, it will effectively automatically reshape the cell array to be a column, with one entry of the cell array being presented per row.
If you want separate cell array character vectors entries to be presented in a row, then you need one uicontrol per column, or you need to switch to uitable()
The alternative is to join the contents together into one character vector or string. If you do that, you lose the internal boundaries unless you deliberately preserve them.
bytes = strjoin(icd, ' '); %cannot tell the boundaries between original entries
or
bytes = strjoin(icd, '|'); %boundaries are visually preserved. You might want ' | ' instead.

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by