hey assistent I have this function in matlab function depstatembfigparafunct()…
- User
hey assistent I have this function in matlab function depstatembfigparafunct()
hfigpara=findobj(0,'Tag','depstatembfigpara'); load(fullfile(racine,'parastatemb'));
test=1; % c'est OK
string=get(findobj(0,'Tag','course'),'string'); L=length(string);
% course indcourse=get(findobj(0,'Tag','course'),'value');
if indcourse==L test=0; message return end
if strcmp(lower(string{indcourse}),'time')==1 test=0; message return end
% effort indeffort=get(findobj(0,'Tag','effort'),'value');
if indeffort==L test=0; message return end
if strcmp(lower(string{indeffort}),'time')==1 test=0; message return end
if test==1 select_nom{1}=string{indcourse}; select_nom{2}=string{indeffort}; select_ind(1)=indcourse; select_ind(2)=indeffort;
save(fullfile(racine,'parastatemb'),'select_nom','select_ind','inforapport','test') uiresume delete(hfigpara)end
function message
warndlg('Votre sélection est incorrecte ou incompléte','Attention') can i change the save to a return function?
- Assistant
Yes, you can modify the function to return values instead of saving them to a file. To do this, you would need to change the way your function handles the
select_nom,select_ind, and potentially other variables.Here's how you can achieve that. Instead of saving to a file with , you can return these variables to the caller of the function. You will need to modify the function definition to include output arguments.
- User
wait I don't undersantad, this function is a callback function from an ui button. how to save this variables after the function is called
- Assistant
- User
how to create a function in matlab that return something
- Assistant
Creating a function in MATLAB that returns values is a straightforward process. Below are the steps for creating a function that can return one or more values:
Steps to Create a Function in MATLAB
- Define the Function: Use the keyword, followed by the output(s), the function name, and input(s).
- User
the names out1 out2 must be the same in the function name as in the code? for example I want to return arrays select_nom, select_id and test
- Assistant
- User
can you remove me info from this Fsc=even.freq(info.select_ind(1)); indice=find(even.repart(:,info.select_ind(1))>0); value=even.repart(indice,info.select_ind(1)); course(:,1)=even.essai{indice}(:,1); course(:,2)=filtresmo(even.essai{indice}(:,value),ceil(0.1*Fsc));
Fse=even.freq(info.select_ind(2)); indice1=find(even.repart(:,info.select_ind(2))>0); value=even.repart(indice1,info.select_ind(2)); effort(:,1)=even.essai{indice1}(:,1); effort(:,2)=even.essai{indice1}(:,value);
- Assistant
Certainly! To remove the usage of the
infovariable from your provided MATLAB code, you can directly use theselect_indvariable (assumingselect_indis also accessible in the current context). Here's the modified code:Original Code:
Fsc = even.freq(info.select_ind(1)); indice = find(even.repart(:, info.select_ind(1)) > 0); value = even.repart(indice, info.select_ind(1)); course(:, 1) = even.essai{indice}(:, 1); course(:, 2) = filtresmo(even.essai{indice}(:, value), ceil(0.1 * Fsc)); Fse = even.freq(info.select_ind(2)); indice1 = find(even.repart(:, info.select_ind(2)) > 0); value = even.repart(indice1, info.select_ind(2)); effort(:, 1) = even.essai{indice1}(:, 1); effort(:, 2) = even.essai{indice1}(:, value); - User
select_nom
Error while evaluating UIControl Callback.
Brace indexing is not supported for variables of this type. can't I output arrays?
- Assistant
- User
how to uncoment block in matlab
- Assistant
In MATLAB, you can uncomment code blocks that have been commented out using the following methods:
1. Using the Comment and Uncomment Toolbar Buttons
If you are using the MATLAB Editor, you can easily uncomment lines of code using the built-in toolbar buttons. Here's how:
- Highlight the Block: Select the lines of code you wish to uncomment.
- Click on the Uncomment Button: Look for the "Uncomment" button, which usually looks like a paper with a crossed-out pen icon (or simply looks like the comment button, but highlighted). You can find it in the MATLAB Editor's toolbar.
2. Keyboard Shortcuts
You can use keyboard shortcuts to uncomment selected lines in the MATLAB Editor:
- User
Brace indexing is not supported for variables of this type.
Error in depstatembfigparafunct_withreturn (line 20) if strcmp(lower(string{indcourse}),'time')==1
Error in depstatembfunct>traite_effort_course (line 333) [select_ind, test] = depstatembfigparafunct_withreturn()
- Assistant
- User
ok how to output an array and add things to it in matlab
- Assistant
- User
how to create an output function in matlab
- Assistant