Answered
Combining cells into a single cell
Simpler: out = cat(3,z{:}) https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html https://www.mathworks...

7 years ago | 1

Answered
Array not returning any value when passed through a nested function
Inside your nested function you allocate to U, but not to u. MATLAB is case sensitive! Inside the nested function you allocate ...

7 years ago | 0

Answered
print output in table format and print the max value
% Density, kg/m^3 rho = 210; T = 2.5; % Volume , m^3 V = 0.018457; % Diameters, m D = [0.05 0.10 0.15 0.20]; % Height, ...

7 years ago | 1

| accepted

Answered
copy 1 part of text in complex text file
This copies the exact text from the input file into the output file, starting from "output final hypocenters" until the end of t...

7 years ago | 1

| accepted

Answered
The error using "load" and "fgets" codes in MATLAB 2013a?
Use fgetl, not fgets: Read_Pr = load(fgetl(fid)) % ^ As its help clearly states, fgets includes the newlines...

7 years ago | 0

| accepted

Answered
How can i use ' character in a string
How to create character arrays (including single quotes) is described in the documentation: https://www.mathworks.com/help/matl...

7 years ago | 1

| accepted

Answered
Mesh 3-D plot axes position
Set the axes' Projection, CameraPosition and CameraUpVector properties: https://www.mathworks.com/help/matlab/ref/matlab.graphi...

7 years ago | 0

Answered
How can I keep values of an array random.
Use randperm to generate a random permutation of that vector: >> T = [0,1,2,7,71,158,187]; >> A = T(randperm(numel(T))) A = ...

7 years ago | 0

Answered
convert categorical to numeric
https://www.mathworks.com/matlabcentral/answers/394456-how-to-convert-from-categorical-to-double https://www.mathworks.com/matl...

7 years ago | 0

| accepted

Answered
How to load a file in a function
"'tubeguide' is the function name, and 'hamm_and_city' is the file I'm attempting to load, but currently, nothing loads into the...

7 years ago | 0

| accepted

Answered
How to apply a equation to specific rows in a matrix
X = m(:,1)<=10; Y = 10<m(:,1) & m(:,1)<=25; Z = nan(size(m,1),1); Z(X) = m(X,2).^2 .* 3.*n(X,2).^2; Z(Y) = m(Y,2).*2; Givin...

7 years ago | 0

| accepted

Answered
How to loop through all files in subfolders in a main folder?
https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html D = 'full path to the main folder'; S = d...

7 years ago | 6

| accepted

Answered
Error while evaluating UIControl Callback.
As its help clearly explains, run will run a script, but it will not run a function (e.g. a GUI main file). https://www.mathwor...

7 years ago | 0

| accepted

Answered
Divide a cell arrays with a part of another cell array?
Division is not defined for container classes (like cell arrays), it is only defined for numeric types. Which means that you wil...

7 years ago | 0

| accepted

Answered
Matlab coder giving issue with 'textscan'
Basically you will have to read the data as characters, and then convert to numeric. Probably the easiest way to do this is to u...

7 years ago | 3

| accepted

Answered
loop to extract set of rows for .txt file
hdr = {}; num = {}; [fid,msg] = fopen('text.txt','rt'); % Ignore first five lines: for k = 1:5 fgetl(fid); end % Read...

7 years ago | 1

| accepted

Answered
extracting variable from callback into base workspace
"However, I have seen experts saying assignin() is not a good suggestion." assignin should definitely be avoided, as should any...

7 years ago | 0

| accepted

Answered
How do I get the maximum numbers of every "increasing pattern" in each row in a matrix?
>> A = [1,2,3,1,2,3,4,1,2,1,2,3,4,1,1;1,2,1,1,2,3,1,2,3,4,1,2,3,4,5] A = 1 2 3 1 2 3 4 1 2 1 2 3 4 ...

7 years ago | 1

| accepted

Answered
How to get Random numbers only from -1 1 and 2?
The easiest way is to define a vector of the values that you want and use (random) indexing: >> V = [-1,1,2]; >> V(randi(numel...

7 years ago | 1

| accepted

Answered
I have a .mat file that is a (1 x 1) struct with 3 fields and every fields is a (54057 x 2) double array. How i can plot this structure?
There is no need to use a loop: plot3(Data.mocap_x,Data.mocap_y,Data.mocap_z)

7 years ago | 0

Answered
Not enough input arguments.
You defined the function HiopH with two input arguments: function ph = HionpH (pH,b) In earlier threads we helped you to para...

7 years ago | 0

| accepted

Answered
Read mixed numbers in Matlab
opt = {'CollectOutput',true,'Delimiter',','}; fmt = repmat('%s',1,4); [fid,msg] = fopen('data.txt','rt'); assert(fid>=3,msg);...

7 years ago | 0

| accepted

Answered
How to vectorise the code below
Here are some vectorized versions of your functions: R = 5; A = [1,1,-1,-1,1;1,-1,-1,1,1]; B = cat(3,A(1,:),A(2,:)); for x =...

7 years ago | 1

| accepted

Answered
is there any function for adding zero ? related toa other matrix
>> A = [1,2,4,5;2,6,3,5;2,7,6,2] A = 1 2 4 5 2 6 3 5 2 7 6 2 >> B = [1,2;3,2] B = 1 2 ...

7 years ago | 3

| accepted

Answered
how to find resultant min Graph.
>> W = cat(3,A,B,C,D); >> R = min(W./(W~=0),[],3) R = 1 2 3 4 5 1 2 4 5 5 3 4 7 8 9

7 years ago | 1

| accepted

Answered
Avoid for loop?
Simpler: >> hankel(1:6,6:9) ans = 1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7 5 6 7 8 ...

7 years ago | 0

Answered
Issue in separating single channel from color image
"The issue is that image is shown as (almost) grayscale image instead of (expected) red(ish) image" It is possible that your ex...

7 years ago | 0

Answered
Matlab 2014b bug: Warning: Matrix is singular to working precision.
"I am getting wierd warning when I try to invert matrix" It is not weird at all: you confused how floating point numbers are di...

7 years ago | 2

Answered
All Possible Combinations of 2 vectors
>> [A,B,C,D,E] = ndgrid(1:5); >> M = [A(:),B(:),C(:),D(:),E(:)]; M = 1 1 1 1 1 2 1 1 1 1 3 1 1...

7 years ago | 0

| accepted

Answered
How to make vector increasing same value??
repelem([1,2,3,4],4)

7 years ago | 2

| accepted

Load more