How to solve the error?

1 view (last 30 days)
Darsana P M
Darsana P M on 25 Mar 2018
Commented: Image Analyst on 26 Mar 2018
iop=cat(4,CIPH,TAGG'); I got this error:
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in encryyyy (line 239)
iop=cat(4,CIPH,TAGG');
I would like to combine: CIPH and TAG
whos TAG
Name Size Bytes Class Attributes
TAG 16x2 64 char
>> whos CIPH
Name Size Bytes Class Attributes
CIPH 4-D 7296 cell
How to solve this?
I am working on cryptography, AES-GCM algorithm. As output, I get cipher text and tag. I want to combine them at output. I found this operation 'cat to combine texts. What is the other alternative to do this?
  1 Comment
Rik
Rik on 25 Mar 2018
What you want is not possible. How should Matlab concatenate two variables of totally different dimensions and even different file types?
The question is why you want to do this. Maybe we can help you solve that problem.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 25 Mar 2018
Depends on what you want. You could assign it to a field in a structure. You could write them to a character array. You could put them into cells of a cell array. You could write the variables to a .mat file, etc.
  10 Comments
Darsana P M
Darsana P M on 25 Mar 2018
Can I now combine them after making then as structures??
Image Analyst
Image Analyst on 26 Mar 2018
I'm not sure how you want to combine then. You can combine different structures, but you can't combine two totally different things. Let's say the 4-D things is a video, in other words a series of multiple 3-D images. They are 3-D because they are color, and 4D because at each point in time we have a new/different RGB image. Now let's say you have a gray scale 2-D image and you want to "combine it". Well how? Do you want to add it as a frame to the end of the video? You can't, unless you turn it into a 3-D array, like an RGB image. If you do THAT you can do it, but otherwise you can't. It's basically the same for your situation. You can't combine a 2-D array with a 4-D array directly. You need to do something to allow the concatenation/combination, but you have not said HOW. You can't just do it without saying how to do it.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!