how to write this code in single line

Hi guys. I need to know how to write this code in a single line, or two at most. Any suggestions? It's welcome.
I have many to write so I need to summarize this .
xlswrite('affichp',str2num(get(handles.editMa,'string')),get(handles.edit1,'string'),'B2')
xlswrite('affichp',str2num(get(handles.editPH,'string')),get(handles.edit1,'string'),'B3')
xlswrite('affichp',str2num(get(handles.editCH,'string')),get(handles.edit1,'string'),'B4')
xlswrite('affichp',str2num(get(handles.editEN,'string')),get(handles.edit1,'string'),'B5')
xlswrite('affichp',str2num(get(handles.editTPph,'string')),get(handles.edit1,'string'),'B6')
xlswrite('affichp',str2num(get(handles.editTPch,'string')),get(handles.edit1,'string'),'B7')
Thanks.

回答 (1 件)

Image Analyst
Image Analyst 2016 年 11 月 21 日

0 投票

Does this work:
ca = {handles.editMa.String, handles.editPH.String, handles.editCH.String, handles.editEN.String, handles.editTPph.String, handles.editTPch.String}
xlswrite('affichp', ca, 'My Results', 'B2')

2 件のコメント

adel amim
adel amim 2016 年 11 月 26 日
編集済み: adel amim 2016 年 11 月 26 日
thanks but it didn't work but you give me idea it didn't worked well
ca= {handles.editMa,'String'; handles.editPH,'String'; andles.editCH,'String'; handles.editEN,'String'; handles.editTPph,'String'; handles.editTPch,'String'}
xlswrite('affichp',ca,get(handles.edit1,'string'),'B2')
Image Analyst
Image Analyst 2016 年 11 月 26 日
I can't see how that would be good. Your first column of ca is a bunch of uicontrol objects (edit field handles), and the second column is all strings that say "String". What good is that? At least my code extracted the actual string in the edit text box from the edit text box and placed it into the cell array. I would think that would be more useful than simply saying "String".

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

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

タグ

質問済み:

2016 年 11 月 21 日

コメント済み:

2016 年 11 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by