Prev: cognitive radio
Next: Combining histogram and plot
From: Christopher Hummersone on 9 Sep 2009 11:12 Sorry, my bad, I only skim-read. What about using eval? Chris
From: Steven Lord on 9 Sep 2009 13:00
"ImageAnalyst" <imageanalyst(a)mailinator.com> wrote in message news:d0dea7e2-a6c0-4115-829b-d7192b8901fc(a)p10g2000prm.googlegroups.com... > On Sep 9, 10:44 am, "qooroo " <qooro...(a)gmailDOT.comREMOVECAPS> wrote: > > ImageAnalyst <imageanal...(a)mailinator.com> wrote in message > > <ed3aa391-7ff3-4709-9c8b-7194af86a...(a)r9g2000yqa.googlegroups.com>... > > > You'd think. But no. Here's my code from R2009b prerelease to test > > > what you suggested: > > > > > %===================================================================== > > > function edtRegion1_Callback(hObject, eventdata, handles) > > > % hObject handle to edtRegion1 (see GCBO) > > > % eventdata reserved - to be defined in a future version of MATLAB > > > % handles structure with handles and user data (see GUIDATA) > > > % Hints: get(hObject,'String') returns contents of edtRegion1 as text > > > % str2double(get(hObject,'String')) returns contents of > > > edtRegion1 as a double > > > strRegionName = get(hObject,'String'); > > > caRegionName = get(handles.edtRegion1, 'string'); > > > > > When I check strRegionName and caRegionName in the workspace, guess > > > what? > > > It says they're both 1 by 1 cell arrays. > > > -ImageAnalyst > > > > that's terrifying. and would make quite a few of my guis bad. just for > > example string concatenation, > > > > strRegionName = get(hObject,'String'); > > strFull = [strRegionName '_please let me be one string'] > > > > would give a 1x2 cell, not a complete string. surely it's a bug? > > > > -qooroo- > > ------------------------------------------------------------------------------------------------------------------------------------------ > Even the Mathworks tech support folks were surprised. They're the > ones who told me to use iscell() workaround to check so that it would > work for any version. I'll send it in as a bug report. But with my > license lasting only about 20 days, the new release is about to come > out within that time I imagine, so I'm not sure it will make it in if > they don't already know about it. I notified them of another bug a > couple of weeks ago and they said that they couldn't fix it in time. If by "the new release" you mean release R2009b, it's already out; it was released last Friday. http://www.mathworks.com/products/new_products/latest_features.html If by "the new release" you mean release R2010a, it's due out sometime in the spring. > What you said was right (I think Chris misunderstood). I ran your > code in R2009b and verfied that it is, in fact, a 1 by 2 cell and you > do not have one long string. I am not sure why they decided to make > this change. Unless they fix this, you'll be implementing the > workaround like I did to have your old m-files run in the new > version. Maybe Steve Lord has some inside info on this???? > -ImageAnalyst I believe the concatenation behavior is is related to a change we made a while back related to the behavior of concatenation with cell arrays and numeric arrays. In older releases (I forget exactly when we made this change) this code would error: x = [{1 2 3} 1e4] because this was treated as: x = [{1 2 3} cell(1e4)] which would try to create a 1e4-by-1e4 cell array and combine it with a 1-by-3 cell array. What we believed most users would expect was a 4-element cell array whose fourth cell was {1e4}: x = [{1 2 3} {1e4}] % or x = {1 2 3 1e4} and that's what it currently does. As for the uicontrol behavior you're seeing, I did a quick search (because this didn't sound familiar) and I think you may be experiencing the problem described in bug report 250127: http://www.mathworks.com/support/bugreports/250127 If you're still communicating with Technical Support about this issue, ask them to speak to the developers working on that bug report. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ |