Error Using Subsindex
Contents |
Support Answers MathWorks Search MathWorks.com MathWorks Answers Support MATLAB Answers™ MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak Anniversary Home Ask Answer subsindex matlab Browse More Contributors Recent Activity Flagged Content Flagged as Spam Help MATLAB
Function 'subsindex' Is Not Defined For Values Of Class 'function_handle'.
Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak Anniversary Home Ask Answer Browse More
Function 'subsindex' Is Not Defined For Values Of Class 'cell'. Legend
Contributors Recent Activity Flagged Content Flagged as Spam Help Trial software Katarzyna Wieciorek (view profile) 13 questions 4 answers 0 accepted answers Reputation: 7 Vote1 Function 'subsindex' is not defined for
Function 'subsindex' Is Not Defined For Values Of Class 'tf'.
values of class 'cell'. Asked by Katarzyna Wieciorek Katarzyna Wieciorek (view profile) 13 questions 4 answers 0 accepted answers Reputation: 7 on 20 Mar 2015 Latest activity Commented on by Katarzyna Wieciorek Katarzyna Wieciorek (view profile) 13 questions 4 answers 0 accepted answers Reputation: 7 on 29 Apr 2015 Accepted Answer by Sean de Wolski Sean de Wolski (view profile) 14 questions 4,289 function 'subsindex' is not defined for values of class 'network'. answers 1,502 accepted answers Reputation: 8,741 969 views (last 30 days) 969 views (last 30 days) Hi,I understand what error says but I don't know how to improve my function. I am not sure what exactly is seen as cell and how to achieve my goal. I loaded file to be read.*Error using subsindex Function 'subsindex' is not defined for values of class 'cell'.Error in EEGmeans (line 36) means(i) = mean(alldata(n,:));*function [ means ] = EEGmeans( ) %EEGmeans loads the .mat file with EEG signal and calculates means for %electrode and trials determined by user %loading .mat file load('eeg_data.mat'); %user determines number of elecrode and trials for h=1:64 disp([num2str(h), ' - ', data_org.label{h}]) end eprompt = 'Type number of electrode. You can see displayed numbers and labels in your command window.'; tprompt = 'Type numbers of trials (1-61) in form of a vector [t1, t2, t3, ...].'; edlg_title = 'Electrode'; tdlg_title = 'Trials'; num_lines = 1; defe = {'1'}; deft = {'[1, 2, 3]'}; electrode = str2double((inputdlg(eprompt,edlg_title,num_lines,defe))); trials = (inputdlg(tprompt,tdlg_title,num_lines,deft)); alldata = zeros(61,160); %getting data for trials for selected electrode for g = 1 : 61 alldata(g,:)=data_org.trial{g}(electrod
Support Answers MathWorks Search MathWorks.com MathWorks Answers Support MATLAB Answers™ MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak function subsindex is not defined for values of class matlab ui control uicontrol Anniversary Home Ask Answer Browse More Contributors Recent Activity Flagged Content Flagged function subsindex is not defined for values of class matlab ui figure as Spam Help MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak Anniversary function 'subsindex' is not defined for values of class 'datetime' Home Ask Answer Browse More Contributors Recent Activity Flagged Content Flagged as Spam Help Trial software Jan (view profile) 7 questions 1 answer 0 accepted answers Reputation: 0 Vote0 https://www.mathworks.com/matlabcentral/answers/184260-function-subsindex-is-not-defined-for-values-of-class-cell subsindex error Asked by Jan Jan (view profile) 7 questions 1 answer 0 accepted answers Reputation: 0 on 16 Apr 2012 Accepted Answer by Walter Roberson Walter Roberson (view profile) 27 questions 27,551 answers 9,623 accepted answers Reputation: 49,797 76 views (last 30 days) 76 views (last 30 days) In this piece of script I am trying to use a https://www.mathworks.com/matlabcentral/answers/35639-subsindex-error shortcut adapted from another script so that I don´t have to write out each file name I want to import. %open right path cd (PATHIN) %read in all -vhdr files list=dir('*.vhdr'); len=length(list); SUBJ=cell(1,len); Here I check what SUBJ is and get [] [] as the answer...So then I start the for loop to read in the data: for s=1:len(SUBJ)And it gives me an error which says- Error using subsindex. Function ´subsindex´ is not defined for values of class ´cell´.I am guessing that when I writelen=length(list); I am converting the list into a numerical value of the number of files so that are in the directory. What should I write instead?Thanks in advance for the help! JD 0 Comments Show all comments Tags subsindexcell Products No products are associated with this question. Related Content 1 Answer Walter Roberson (view profile) 27 questions 27,551 answers 9,623 accepted answers Reputation: 49,797 Vote1 Link Direct link to this answer: https://www.mathworks.com/matlabcentral/answers/35639#answer_44616 Answer by Walter Roberson Walter Roberson (view profile) 27 questions 27,551 answers 9,623 accepted answers Reputation: 49,797 on 16 Apr
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn http://stackoverflow.com/questions/10061337/matlab-error-function-subsindex-is-not-defined-for-values-of-class-struct more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags http://ask.cvxr.com/t/subindex-error-for-the-class-cvx/828 Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up matlab error: Function 'subsindex' is not defined for values of class 'struct' up vote 4 down vote favorite I tried these commands: im=imread('untitled_test1.jpg'); im1=rgb2gray(im); im1=medfilt2(im1,[15 15]); is not BW = edge(im1,'sobel'); msk=[0 0 0 0 0; 0 1 1 1 0; 0 1 1 1 0; 0 1 1 1 0; 0 0 0 0 0;]; B=conv2(double(BW),double(msk)); Ibw = im2bw(B); CC = bwconncomp(Ibw); %Ibw is my binary image stats = regionprops(CC,'pixellist'); % pass all over the stats for i=1:length(stats), size = length(stats(i).PixelList); % check only the relevant stats (the black ellipses) if size >150 && size < 600 % fill the black pixel by is not defined white x = round(mean(stats(i).PixelList(:,2))); y = round(mean(stats(i).PixelList(:,1))); Ibw = imfill(Ibw, [x, y]); else Ibw([CC.PixelIdxList{i}]) = false; end; end; (here I have another command lines, but I guess the problem is not because of them.) labeledImage = bwlabel(binaryImage, 8); % Label each blob so we can make measurements of it blobMeasurements = regionprops(labeledImage, Ibw, 'all'); numberOfBlobs = size(blobMeasurements, 1); I got this error message: ??? Error using ==> subsindex Function 'subsindex' is not defined for values of class 'struct'. Error in ==> test2 at 129 numberOfBlobs = size(blobMeasurements, 1); please help, thank you! :] matlab share|improve this question asked Apr 8 '12 at 8:00 Alon Shmiel 171134695 add a comment| 2 Answers 2 active oldest votes up vote 13 down vote accepted You're getting that error because you have created a variable called "size" which shadows the built-in function SIZE. Instead of calling the function to compute numberOfBlobs, MATLAB instead tries to index the variable using the structure blobMeasurements as an index (which doesn't work, as the error message shows). In general, you shouldn't give a variable or function the name of an already existing function (unless you know what you're doing). Just change the name of the variable in your code to something other than "size", issue the command clear size to clear the old size variable from the workspace, and rerun your code. share|improve this answer
reason pls. cvx_beginvariables d(n+4)minimize (d(n+1) + c/n^(1/p)*norm(d(1:n),p))subject to- d(n+1) - group'*(xdata * d(n+2:n+3) - d(n+4)) <= d(1:n)d(1:n) >= 0norm(d(n+2:n+3),2)= 1cvx_end Mark_L_Stone (Mark L. Stone) 2015-04-13 15:05:22 UTC #2 norm(d(n+2:n+3),2)= 1is erroneous and what is causing the error message. If you meant this as an equality constraint, you need ==, not =, i.e.,norm(d(n+2:n+3),2) == 1 Unfortunately, that is not convex and will be rejected by CVX. However, if you mean it to be <=, then you're in luck. sjk 2015-04-13 15:19:52 UTC #3 Thanks. Actually I wanted to have squared norm so i changed it to sum(w'*w)=1; what do you think now? Mark_L_Stone (Mark L. Stone) 2015-04-13 16:17:18 UTC #4 I don't know what w is, but you're not going to be able to specify a nonlinear equality constraint in CVX. If you need such an equality constraint, and you're just doing a one-time solution, you could always specify it as a <= and see if equality happens to be satisfied, in which case you're done. Or perhaps you can concoct some kind of penalty function, expressible in CVX, and the iterate on penalty parameter to get your desired solution. Another approach, and I have NO idea if it will work (converge, and if so, to even a local minimum, and you can forget about guarantee of global minimum), is to use a <= constraint, and add a modified >= constraint, per stephen_boyd's answer in http://ask.cvxr.com/t/how-to-handle-nonlinear-equality-constraints/22/4 , and then iterate as per that answer. Home Categories FAQ/Guidelines Terms of Service Privacy Policy Powered by Discourse, best viewed with JavaScript enabled