Answered
Eliminating columns of undesired length from the answer
C = {[1 2 1 1] [1 1 2 1] [1 2 2] [1 3 1] [2 3] [5]} C(cellfun(@(x)numel(x)~=3,C)) = []

5 years ago | 0

| accepted

Answered
plot command for multiple plots in single figure
Use hold on my_plot(1:10); my_plot(12:25); function my_plot(in) figure(1); hold on; plot(in); end

5 years ago | 0

Answered
how can i input variable in function?
% define your input argument: linedata = [ 1 0 0.000 0.200 2 0 0.000 0.150 3 0 0.000 0.250 1 4 0.035 0.225 1 5 0.025 0.105 ...

5 years ago | 1

| accepted

Answered
Sum of same values in a vector (MATLAB)
V1=[3 2 3 3 2 3 2 3 3 2]; V2=[5;6;5;5;5]; uV1 = unique(V1); for i = 1:numel(uV1) disp(sum(V1(V1 == uV1(i)))); end ...

5 years ago | 0

| accepted

Answered
How do I add a menu to an existing menu like "File" or "Tools" (using uimenu)
Try this: f = figure('Toolbar','none'); m = findall(f,'Type','uimenu','Label','&File'); mitem = uimenu(m,'Text','NewMenu');

5 years ago | 0

Answered
For loop for wind speed analysis
u_lower = 0:25; N = numel(u_lower)-1; u_mean = NaN(1,N); u_std = NaN(1,N); p_mean = NaN(1,N); p_std = NaN(1,N); for i = 1:...

5 years ago | 1

| accepted

Answered
omit plot legend entries
One way is to store the handles to your lines as you create them and make a legend based on a subset of the lines: figure(); m...

5 years ago | 0

| accepted

Answered
How can I convert while loop to for loop?
Assuming the while loop starts with i = 1: for i = 1:5 E_(i)= x(i).^2; if i==1 disp(['The amount of energy a...

5 years ago | 0

| accepted

Answered
Read .txt file into a matrix and remove unwanted text
fid = fopen('N2_trace.txt'); data = fread(fid); fclose(fid); c_data = strsplit(char(data).',newline()); if isempty(c_data{...

5 years ago | 0

Answered
arrayfun doesn't work with rmoutliers
A = [0 2 0 0 0; 0 0 0 4 0; 3 0 0 3 0]; A(:,:,2) = A C = num2cell(A,2) cellfun(@rmoutliers,C,"UniformOutput",false)

5 years ago | 2

| accepted

Answered
Guide: show a table data (readtable)
Try one or both of these: set(handles.uitable1,'data',table2array(dataR)); set(handles.uitable1,'data',table2cell(dataR));

5 years ago | 0

Answered
How can I merge similar rows in a matrix based on the first three columns' value.
Generate some random data mimicking your situation: [X,Y,Z] = ndgrid(1:2,1:3,1:2); A = [X(:) Y(:) Z(:) rand(numel(X),1)]; A(:...

5 years ago | 1

Answered
How to split 36x1 cell array into 36x3 cell array?
fid = fopen('file.txt'); data = fread(fid); fclose(fid); c_data = strsplit(char(data).',newline()); out = repmat({''},nu...

5 years ago | 1

Answered
2D Plot of CSV data
One way you can do it (still with contourf()) is to use a scatteredInterpolant to interpolate and/or extrapolate T from the X,Y ...

5 years ago | 0

Answered
How to make different character for each legend in my code?
close all clear all clc %%% Fixed Parameters B = 2; % Number of Blades R = 10.06; ...

5 years ago | 1

Answered
How to delete 'Userdata' in hObject of Matlab GUI?
Using clear just clears the local variables in the callback function. You should do: set(handles.grafik, 'Userdata', []); ...

5 years ago | 0

| accepted

Answered
Tabulate variable inside a for loop
Here's one way to do what I believe you want to do: x = rand(1,1000); y = rand(1,1000); ind =1; L=length (x); % assuming L...

5 years ago | 1

| accepted

Answered
matlab gui
You'd have to tell imwrite() to write to the file just selected: [filename,pathname]=uiputfile('*.*','Save file as'); if(filen...

5 years ago | 0

Answered
input with structures
I don't know what your GUI does, but here's one way to do it using the input() function: f = {'x' 'y' 'z' 't'}; args = [f; cel...

5 years ago | 0

Answered
Execute command syntax
The character array 'test.a(1)=value' contains the word 'value' rather than the value of the variable "value". You can use sprin...

5 years ago | 0

Answered
Calling same function shows index in position 1 exceed array bounds even having same input matrix size?
If you do this: [rate] = rate(device,BandWidth,Tx,Power1,fading1,No_power); Then rate is now a variable (the output fro...

5 years ago | 0

| accepted

Answered
for-loop prints for last iteration only and stores this last value in all cells of the matrix
Two things: 1. There are missing ellipses (...) on the velocity calculation line, which cause extraneous command-line output ...

5 years ago | 1

| accepted

Answered
how can i extract symbols in leftbottom and rightbottom panals to separate images
im = imread('image.jpeg'); im_top = im(1:30,:,:); im_bottom_left = im(31:end,1:69,:); im_bottom_right = im(31:end,70:end,:)...

5 years ago | 0

Answered
Problem with an if statement
Use the optional second argument to the input() function, 's', which tells input() to return exactly what the user entered, with...

5 years ago | 0

| accepted

Answered
How to remove duplicate element from matrix ?
Here's one way: S=[1 11 1 4 3 14 6 11 13 11 7 15 5 9 9 7] [C,i] = unique(S,'stable') C = [C S(~ismember(1:numel(S),i))]

5 years ago | 1

| accepted

Answered
sort the values in a vector h(n)
Look into sort and abs. h=[0.00275644015144904,0.00355792817060437,-0.00242358119135895,0.00221119427549373,-0.0023118073998726...

5 years ago | 0

| accepted

Answered
I have this function but whenever I call it using its name, I get an error
setup is a function that takes one input argument, bs, so when you call it you need to call it like: setup(10); % to set up a b...

5 years ago | 0

| accepted

Answered
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.
f is a function (handle). If you want the value of f at a, you don't have to evaluate and store it like that. In fact, you canno...

5 years ago | 0

| accepted

Load more