現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
0 投票
I want to use the data below for the logic
Data =
'' ''
'' ''
'' ''
'' ''
if %Data
warndlg('warningstring')
else
end
採用された回答
Image Analyst
2011 年 6 月 18 日
0 投票
Look up isempty(). And you probably want to wrap your warndlg inside a uiwait(). If it's like msgbox(), it will continue with your code, blasting right past that warning message unless you put it inside a uiwait().
9 件のコメント
pink
2011 年 6 月 18 日
yes I've tried it but in case of error
??? Error while evaluating uipushtool ClickedCallback
??? Undefined function or method 'eq' for input arguments of type 'cell'.
data=get(handles.uitable1,'data')
if isempty(data)
warndlg('warningstring')
return
else
end
Paulo Silva
2011 年 6 月 18 日
try this all(all(cellfun(@isempty,c))) instead of isempty, it will detect if all the elements of the cell are empty (like this '' and this []), it isn't perfect but should work for your example.
pink
2011 年 6 月 18 日
hi paul
if uitable1 contain numbers in case of error
data=get(handles.uitable1,'data')
if all(all(cellfun(@isempty,data)))
warndlg('warningstring')
return
else
end
??? Error using ==> cellfun
Input #2 expected to be a cell array, was double instead.
Paulo Silva
2011 年 6 月 18 日
try using arrayfun instead of cellfun, if data can be cell and array you must detect what data is before looking inside it (use the class and strcmp functions)
pink
2011 年 6 月 19 日
Can give examples of the use of class and strcrmp
Walter Roberson
2011 年 6 月 19 日
if ~iscell(data) || all(cellfun(@isempty,data(:))
wardlg('warningstring')
return
end
pink
2011 年 6 月 19 日
hi walter
after I use if ~iscell(data) || all(cellfun(@isempty,data(:))),
all data read is empty, I would like if uitable1 filled figures (not empty) then the variable 'data' is used in further calculations
Walter Roberson
2011 年 6 月 19 日
I will need to do some testing to see when it is possible for the data to not be a cell array when it is retrieved. Unfortunately that is not something I can test from home with my current configuration.
I do not think you should be testing for the emptiness of the cells in the cell-clicked callback: if the user is editing a series of the cells, they are not going to want the calculations to take place until they are finished editing.
If you have the data and it _is_ a cell array and you want to ensure that there is something in each of the cells, then
any(cellfun(@isempty,data(:)))
will be true if there are any empty cells.
pink
2011 年 6 月 19 日
thanks walter..
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Data Type Identification についてさらに検索
タグ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
