Answered
How to display sequence of images in GUI
This line: img_files = num2str((1:seq_len)', [img_path '%04i.jpg']); should be like this: img_files = strcat(img_path,num2str...

5 years ago | 0

Answered
I dont understand, i try to use solve to find x in Matlab Function Block
Looks like you should use syms rather than sym fcn(0) function x = fcn(y) syms a; r1=7.3e-5; r2=-1.1e-7; s1=1.6e-1; s2=1....

5 years ago | 0

Answered
adding limits in scatter plot
line([min(X) max(X)],[3100 3100]);

5 years ago | 0

| accepted

Answered
how to create a matrix when using surf function?
What you are doing there is making F a scalar, but F needs to be a matrix the same size as u and v, so something like this: F =...

5 years ago | 1

Answered
How to export matrix in the form of (column number, row number, value) in CSV?
A = randn(8,4) [m,n] = size(A); [c,r] = meshgrid(1:n,1:m); writematrix([c(:) r(:) A(:)],'output.csv'); % check the result ...

5 years ago | 0

| accepted

Answered
Creating different types of arrays with conditions, then make an array with the combination of all elements, and finally separate the arrays with a sequence
x = 3; y = 4; a = 1000*(1:x).'+(1:y) A = a(randperm(x*y)) [~,idx] = ismember(A,a); [~,new_idx] = sort(mod(idx-1,x)+1); a_n...

5 years ago | 0

| accepted

Answered
How do I extract a vector from a single field in a structured variable?
Maybe this? folder_names = struct('name',{'a','bb','ccc'}) participant_ID = {folder_names.name}

5 years ago | 1

| accepted

Answered
Number of rows based on frequency of one integer and position of another integer
Get the set of unique numbers in the 2nd column: col2_vals = unique(matrix(:,2)); The 5th highest is 4th from the end. S...

5 years ago | 0

| accepted

Answered
How to display arc length of the line created on a line plot based on the input data
% some x and y: x = [10:-1:2 2:10]; y = [5+sqrt(x(1:end/2)) 5-sqrt(x(end/2+1:end))]; plot(x,y,'-o'); set(gca(),'XLim',[0 12]...

5 years ago | 0

| accepted

Answered
Create a new table from a plot constructed from data points
% a table with 1000 rows: t = table((1:1000).',2*(1:1000).'+100,'VariableNames',{'x' 'y'}) % user-defined interval over x: x_...

5 years ago | 0

Answered
Y data addition on scatter plot
You need to convert those cell arrays to numeric matrices before you can plot them (scatter or otherwise): X= { 2 ,3,4,5} Y={ ...

5 years ago | 0

| accepted

Answered
Determine the current position of an object in the context of drag and drop
Basically, in the motion function and button up function, you have to check whether dragging is an element of a or of b and set ...

5 years ago | 0

| accepted

Answered
How to improve calculation time for a huge matrix?
The original method but with SS = 5 to reduce the time (takes ~3.5 seconds): tic syms Q1 Q2 D3 EndEffectorVariables (Q1,Q2,...

5 years ago | 0

| accepted

Answered
Random sized hexagones in a hexagone grid
The problem is here: Rcore = rand(size(Xh))*range(bounds)+bounds(1); R1core = rand(size(Xl))*range(bounds)+bounds(1); Those a...

5 years ago | 0

| accepted

Answered
Error using feval and Invalid function name
You can use an anonymous function, e.g., f = @(x)x/56, or a named function, rather than a character array (f = 'x/56') for feval...

5 years ago | 0

| accepted

Answered
Stopping a for loop when certain values have been reached
values = []; n_tries = 1000; for i = 1:n_tries values(i) = randi(9); if all(ismember(1:9,values)) break ...

5 years ago | 0

| accepted

Answered
how can i split mtrix to three ?
Here is one possible way, if A is your matrix: A1 = A(1:51,:); A2 = A(52:102,:); A3 = A(103:153,:);

5 years ago | 0

Answered
How do I pass variable from one function to another
How about this? function [v] = Popup(obj, handles , h_listbox) parameters=detectImportOptions('Data.xlsx'); ...

5 years ago | 0

| accepted

Answered
Why does my graph come out wrong?
x = -10:0.01:10; y = (x.^2-1).^(2/3); plot(x,y) Note the warning about complex values. The values of y where abs(x) < 1 are c...

5 years ago | 0

Answered
circshift function working explanation needed
circshift(s,d) for a vector s and positive integer d shifts the elements of s to the right by d amount, wrapping back to the beg...

5 years ago | 0

| accepted

Answered
Taking averages of only a few rows out of several?
A = (1:6).'.*(1:100) mean(A(1:3,:)) mean(A(1:3,:),'all') mean(A(end-2:end,:)) mean(A(end-2:end,:),'all')

5 years ago | 0

| accepted

Answered
delete cell and replace with remaining cells in matlab
If you delete elements from an array (of any type including a cell array) from within a for loop that loops over the elements of...

5 years ago | 0

Answered
How do I convert a 3x153 double to a 1x51 matrix?
% Create a 3-by-153 matrix with random data: A = rand(3,153) % Convert the 3-by-153 matrix to a 1-by-51 cell array, with eac...

5 years ago | 0

Answered
How to plot the results below ?
Here is something you can try: close all; clear all; clc %Location of the directory Location = 'F:\3-PIV_Experimental_Data\Ou...

5 years ago | 1

Answered
How to only extract part of the folder name?
Here is one way: folder_name = 'Run 12-27-56.Adaptive PIV.6uqqm6yu'; folder_number = folder_name(find(folder_name == ' ',1)+1:...

5 years ago | 2

Answered
Stract error line 91 and not recognizing the variable
Is something like this what you're trying to do? DataChan1 = importDataChanfile('Data_Chan1.txt'); t=DataChan1{:,1}; % time se...

5 years ago | 1

| accepted

Answered
GUI design according to selection of pop-up
If you used GUIDE then, in the GUI's OpeningFcn, you can call your popupmenu's Callback function or otherwise set the visibility...

5 years ago | 0

Answered
Remove unwanted text from a .txt file
Original code with output: trace = regexp(fileread('trace.txt'),'^(\d+)\.?\d*:[^:]+:\s+([^\n]+)','tokens','lineanchors'); trac...

5 years ago | 0

| accepted

Answered
I can not write piecewise function
sampling=3600; theta_12=linspace(0,2*pi(),sampling+1); T_16 = zeros(1,sampling+1); % idx = theta_12 >= 0 & theta_12 <= 0....

5 years ago | 1

| accepted

Answered
Horizontal concatenate in UItable table
c = readcell('input.xlsx'); c(1,:) = []; idx = ~cellfun(@ischar,c); c(idx) = cellfun(@num2str,c(idx),'UniformOutput',false) ...

5 years ago | 0

Load more